File: /var/www/html/wpbiancoarte/wp-content/plugins/hiroshi-core/assets/js/hiroshi-core.js
(function ( $ ) {
'use strict';
// This case is important when theme is not active
if ( typeof qodef !== 'object' ) {
window.qodef = {};
}
window.qodefCore = {};
qodefCore.shortcodes = {};
qodefCore.listShortcodesScripts = {
qodefSwiper: qodef.qodefSwiper,
qodefPagination: qodef.qodefPagination,
qodefFilter: qodef.qodefFilter,
qodefMasonryLayout: qodef.qodefMasonryLayout,
qodefJustifiedGallery: qodef.qodefJustifiedGallery,
qodefDragCursor: qodefCore.qodefDragCursor,
};
qodefCore.body = $( 'body' );
qodefCore.html = $( 'html' );
qodefCore.windowWidth = $( window ).width();
qodefCore.windowHeight = $( window ).height();
qodefCore.scroll = 0;
$( document ).ready(
function () {
qodefCore.scroll = $( window ).scrollTop();
qodefInlinePageStyle.init();
qodefDynamicBackground.init();
qodefScrollableColumns.init();
}
);
$( window ).resize(
function () {
qodefCore.windowWidth = $( window ).width();
qodefCore.windowHeight = $( window ).height();
}
);
$( window ).scroll(
function () {
qodefCore.scroll = $( window ).scrollTop();
}
);
$( window ).load(
function () {
qodefParallaxItem.init();
qodefAppear.init();
}
);
/**
* Check element to be in the viewport
*/
var qodefIsInViewport = {
check: function ( $element, callback, onlyOnce ) {
if ( $element.length ) {
var offset = typeof $element.data( 'viewport-offset' ) !== 'undefined' ? $element.data( 'viewport-offset' ) : 0.15; // When item is 15% in the viewport
var observer = new IntersectionObserver(
function ( entries ) {
// isIntersecting is true when element and viewport are overlapping
// isIntersecting is false when element and viewport don't overlap
if ( entries[0].isIntersecting === true ) {
callback.call( $element );
// Stop watching the element when it's initialize
if ( onlyOnce !== false ) {
observer.disconnect();
}
}
},
{ threshold: [offset] }
);
observer.observe( $element[0] );
}
},
};
qodefCore.qodefIsInViewport = qodefIsInViewport;
var qodefScroll = {
disable: function () {
if ( window.addEventListener ) {
window.addEventListener(
'wheel',
qodefScroll.preventDefaultValue,
{ passive: false }
);
}
// window.onmousewheel = document.onmousewheel = qodefScroll.preventDefaultValue;
document.onkeydown = qodefScroll.keyDown;
},
enable: function () {
if ( window.removeEventListener ) {
window.removeEventListener(
'wheel',
qodefScroll.preventDefaultValue,
{ passive: false }
);
}
window.onmousewheel = document.onmousewheel = document.onkeydown = null;
},
preventDefaultValue: function ( e ) {
e = e || window.event;
if ( e.preventDefault ) {
e.preventDefault();
}
e.returnValue = false;
},
keyDown: function ( e ) {
var keys = [37, 38, 39, 40];
for ( var i = keys.length; i--; ) {
if ( e.keyCode === keys[i] ) {
qodefScroll.preventDefaultValue( e );
return;
}
}
}
};
qodefCore.qodefScroll = qodefScroll;
var qodefPerfectScrollbar = {
init: function ( $holder ) {
if ( $holder.length ) {
qodefPerfectScrollbar.qodefInitScroll( $holder );
}
},
qodefInitScroll: function ( $holder ) {
var $defaultParams = {
wheelSpeed: 0.6,
suppressScrollX: true
};
var $ps = new PerfectScrollbar(
$holder[0],
$defaultParams
);
$( window ).resize(
function () {
$ps.update();
}
);
}
};
qodefCore.qodefPerfectScrollbar = qodefPerfectScrollbar;
var qodefInlinePageStyle = {
init: function () {
this.holder = $( '#hiroshi-core-page-inline-style' );
if ( this.holder.length ) {
var style = this.holder.data( 'style' );
if ( style.length ) {
$( 'head' ).append( '<style type="text/css">' + style + '</style>' );
}
}
}
};
/**
* Init parallax item
*/
var qodefParallaxItem = {
init: function () {
var $items = $( '.qodef-parallax-item' );
if ( $items.length ) {
$items.each(
function () {
var $currentItem = $( this ),
$y = Math.floor( Math.random() * (-100 - (-25)) + (-25) );
if ( $currentItem.hasClass( 'qodef-grid-item' ) ) {
$currentItem.children( '.qodef-e-inner' ).attr(
'data-parallax',
'{"y": ' + $y + ', "smoothness": ' + '30' + '}'
);
} else {
$currentItem.attr(
'data-parallax',
'{"y": ' + $y + ', "smoothness": ' + '30' + '}'
);
}
}
);
}
qodefParallaxItem.initParallax();
},
initParallax: function () {
var parallaxInstances = $( '[data-parallax]' );
if ( parallaxInstances.length && ! qodefCore.html.hasClass( 'touchevents' ) && typeof ParallaxScroll === 'object' ) {
ParallaxScroll.init(); //initialization removed from plugin js file to have it run only on non-touch devices
}
},
};
qodefCore.qodefParallaxItem = qodefParallaxItem;
/**
* Init dynamic background
*/
var qodefDynamicBackground = {
init: function () {
var backgroundIntances = $("[data-dynamic-background-color]");
if (qodef.body.hasClass('qodef-dynamic-background-color') && backgroundIntances.length) {
$('#qodef-page-inner').append('<div id="qodef-dynamic-background"></div>');
var holder = $('#qodef-dynamic-background'),
scrollBuffer = qodef.scroll,
scrollingDown = true,
page = $('#qodef-page-outer'),
footer = $('#qodef-page-footer'),
currentScroll, instancesInView, activeEl;
//add bgrnd divs
backgroundIntances.each(function () {
qodefDynamicBackground.elementInView($(this) );
});
//calculate scroll direction
var scrollDirection = function() {
currentScroll = qodef.scroll;
if (currentScroll > scrollBuffer){
scrollingDown = true;
} else {
scrollingDown = false;
}
scrollBuffer = currentScroll;
};
holder.css('background-color', backgroundIntances.first().attr('data-dynamic-background-color'));
//colors change logic
$(window).on('scroll', function() {
scrollDirection();
instancesInView = backgroundIntances.filter('.qodef-in-view');
if ( footer.hasClass('qodef--uncover') ) {
if ( qodef.scroll + footer.height() < ( page.height() + page.position().top + page.offset().top ) - footer.height() ) {
holder.removeClass('qodef--display');
} else {
holder.addClass('qodef--display');
}
}
if (instancesInView.length) {
if (scrollingDown) {
activeEl = instancesInView.last();
} else {
activeEl = instancesInView.first();
}
holder.css('background-color') !== activeEl.attr('data-dynamic-background-color') &&
holder.css('background-color', activeEl.attr('data-dynamic-background-color'));
}
});
}
},
elementInView: function (element) {
var toggleClasses = function() {
if (qodef.scroll > element.offset().top - qodef.windowHeight && qodef.scroll < element.offset().top + element.height()) {
if (!element.hasClass('qodef-in-view')) {
element.addClass('qodef-in-view');
}
} else {
if (element.hasClass('qodef-in-view')) {
element.removeClass('qodef-in-view');
}
}
}
$(window).on('scroll', function(){
toggleClasses();
});
toggleClasses();
}
};
qodefCore.qodefDynamicBackground = qodefDynamicBackground;
/**
* Init parallax item
*/
var qodefScrollableColumns = {
init: function () {
var scrollableColumn = $('.qodef-elementor-column-scrollable > .elementor-container > .elementor-column');
if ( scrollableColumn.length && $('body').hasClass('qodef-browser--firefox') && typeof qodefCore.qodefPerfectScrollbar === 'object' ) {
scrollableColumn.each(
function () {
qodefCore.qodefPerfectScrollbar.init( $( this ) );
}
);
}
},
};
qodefCore.qodefScrollableColumns = qodefScrollableColumns;
/**
* Init animation on appear
*/
var qodefAppear = {
init: function () {
this.holder = $('.qodef--has-appear:not(.qodef--appeared), .qodef--custom-section-appear:not(.qodef--appeared)');
if (this.holder.length) {
this.holder.each(
function () {
var holder = $(this),
randomNum = gsap.utils.random(10, 300, 130),
appearDelay = $(this).attr('data-appear-delay');
appearDelay = appearDelay ? appearDelay : randomNum;
qodefCore.qodefIsInViewport.check(
holder,
()=>{
qodef.qodefWaitForImages.check(
holder,
function(){
setTimeout (
function () {
holder.addClass( 'qodef--appeared' );
},
appearDelay
)
}
)
}
);
}
);
}
},
};
qodefCore.qodefAppear = qodefAppear;
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefBackToTop.init();
}
);
var qodefBackToTop = {
init: function () {
this.holder = $( '#qodef-back-to-top' );
if ( this.holder.length ) {
// Scroll To Top
this.holder.on(
'click',
function ( e ) {
e.preventDefault();
qodefBackToTop.animateScrollToTop();
}
);
qodefBackToTop.showHideBackToTop();
}
},
animateScrollToTop: function () {
var startPos = qodef.scroll,
newPos = qodef.scroll,
step = .9,
animationFrameId;
var startAnimation = function () {
if ( newPos === 0 ) {
return;
}
newPos < 0.0001 ? newPos = 0 : null;
var ease = qodefBackToTop.easingFunction( (startPos - newPos) / startPos );
$( 'html, body' ).scrollTop( startPos - (startPos - newPos) * ease );
newPos = newPos * step;
animationFrameId = requestAnimationFrame( startAnimation );
};
startAnimation();
$( window ).one(
'wheel touchstart',
function () {
cancelAnimationFrame( animationFrameId );
}
);
},
easingFunction: function ( n ) {
return 0 == n ? 0 : Math.pow( 1024, n - 1 );
},
showHideBackToTop: function () {
$( window ).scroll(
function () {
var $thisItem = $( this ),
b = $thisItem.scrollTop(),
c = $thisItem.height(),
d;
if ( b > 0 ) {
d = b + c / 2;
} else {
d = 1;
}
if ( d < 1e3 ) {
qodefBackToTop.addClass( 'off' );
} else {
qodefBackToTop.addClass( 'on' );
}
}
);
},
addClass: function ( a ) {
this.holder.removeClass( 'qodef--off qodef--on' );
if ( a === 'on' ) {
this.holder.addClass( 'qodef--on' );
} else {
this.holder.addClass( 'qodef--off' );
}
}
};
})( jQuery );
(function ($) {
"use strict";
$( window ).on(
'load',
function () {
qodefBackgroundText.init();
}
);
$( window ).resize(
function () {
qodefBackgroundText.init();
}
);
var qodefBackgroundText = {
init : function () {
var $holder = $( '.qodef-background-text' );
if ($holder.length) {
$holder.each(
function () {
qodefBackgroundText.responsiveOutputHandler( $( this ) );
}
);
}
},
responsiveOutputHandler : function ($holder) {
var breakpoints = {
3840: 1441,
1440: 1367,
1366: 1025,
1024: 1
};
$.each(
breakpoints,
function (max, min) {
if (qodef.windowWidth <= max && qodef.windowWidth >= min) {
qodefBackgroundText.generateResponsiveOutput( $holder, max );
}
}
);
},
generateResponsiveOutput: function ($holder, width) {
var $textHolder = $holder.find( '.qodef-m-background-text' );
if ($textHolder.length) {
$textHolder.css(
{
'font-size': $textHolder.data( 'size-' + width ) + 'px',
'top' : $textHolder.data( 'vertical-offset-' + width ) + 'px',
}
);
}
},
};
window.qodefBackgroundText = qodefBackgroundText;
})( jQuery );
(function ($) {
'use strict';
$(document).ready(
function () {
qodefDragCursor.init();
}
);
var qodefDragCursor = {
init : function () {
const $holder = $('.qodef-swiper--show-drag-cursor');
if ($holder.length) {
$holder.each(
function () {
const $dragCursorTargetArea = $(this).find('.swiper-wrapper');
qodefDragCursor.handleMouseMove($(this), $dragCursorTargetArea);
}
);
}
},
handleMouseMove: function ($holder, $dragCursorTargetArea) {
const customCursor = qodefGlobal.vars.dragCursor;
$holder.append('<div class="qodef-m-custom-cursor qodef-m"><div class="qodef-m-custom-cursor-inner">' + customCursor + '</div></div>');
const $customCursorHolder = $('.qodef-m-custom-cursor');
$holder.each(
function () {
// custom cursor position
$dragCursorTargetArea.on(
'mousemove',
function (event) {
$customCursorHolder.css(
{
top : event.clientY - 60, // half of svg height
left: event.clientX - 60, // half of svg width
}
);
}
);
$dragCursorTargetArea.on(
'mouseover mouseenter',
function () {
if (!$holder.hasClass('qodef-swiper-drag-cursor--active')) {
$holder.addClass('qodef-swiper-drag-cursor--active');
}
}
).on(
'mouseleave',
function () {
if ($holder.hasClass('qodef-swiper-drag-cursor--active')) {
$holder.removeClass('qodef-swiper-drag-cursor--active');
}
}
);
}
);
},
};
qodefCore.qodefDragCursor = qodefDragCursor;
})(jQuery);
(function ( $ ) {
'use strict';
$( window ).on(
'load',
function () {
qodefUncoverFooter.init();
}
);
var qodefUncoverFooter = {
holder: '',
init: function () {
this.holder = $( '#qodef-page-footer.qodef--uncover' );
if ( this.holder.length && ! qodefCore.html.hasClass( 'touchevents' ) ) {
qodefUncoverFooter.addClass();
qodefUncoverFooter.setHeight( this.holder );
$( window ).resize(
function () {
qodefUncoverFooter.setHeight( qodefUncoverFooter.holder );
}
);
}
},
setHeight: function ( $holder ) {
$holder.css( 'height', 'auto' );
var footerHeight = $holder.outerHeight();
if ( footerHeight > 0 ) {
$( '#qodef-page-outer' ).css(
{
'margin-bottom': footerHeight,
'background-color': qodefCore.body.css( 'backgroundColor' )
}
);
$holder.css( 'height', footerHeight );
}
},
addClass: function () {
qodefCore.body.addClass( 'qodef-page-footer--uncover' );
}
};
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefFullscreenMenu.init();
}
);
$( window ).on(
'resize',
function () {
qodefFullscreenMenu.handleHeaderWidth( 'resize' );
}
);
var qodefFullscreenMenu = {
init: function () {
var $fullscreenMenuOpener = $( 'a.qodef-fullscreen-menu-opener' ),
$menuItems = $( '#qodef-fullscreen-area nav ul li a' );
if ( $fullscreenMenuOpener.length ) {
// prevent header changing width when fullscreen menu is open
qodefFullscreenMenu.handleHeaderWidth( 'init' );
// open popup menu
$fullscreenMenuOpener.on(
'click',
function ( e ) {
e.preventDefault();
var $thisOpener = $( this );
if ( ! qodefCore.body.hasClass( 'qodef-fullscreen-menu--opened' ) ) {
qodefFullscreenMenu.openFullscreen( $thisOpener );
$( document ).keyup(
function ( e ) {
if ( e.keyCode === 27 ) {
qodefFullscreenMenu.closeFullscreen( $thisOpener );
}
}
);
} else {
qodefFullscreenMenu.closeFullscreen( $thisOpener );
}
}
);
// open dropdowns
$menuItems.on(
'tap click',
function ( e ) {
var $thisItem = $( this );
if ( $thisItem.parent().hasClass( 'menu-item-has-children' ) ) {
e.preventDefault();
qodefFullscreenMenu.clickItemWithChild( $thisItem );
} else if ( $thisItem.attr( 'href' ) !== 'http://#' && $thisItem.attr( 'href' ) !== '#' ) {
qodefFullscreenMenu.closeFullscreen( $fullscreenMenuOpener );
}
}
);
}
},
openFullscreen: function ( $opener ) {
$opener.addClass( 'qodef--opened' );
qodefCore.body.removeClass( 'qodef-fullscreen-menu-animate--out' ).addClass( 'qodef-fullscreen-menu--opened qodef-fullscreen-menu-animate--in' );
qodefCore.qodefScroll.disable();
},
closeFullscreen: function ( $opener ) {
$opener.removeClass( 'qodef--opened' );
qodefCore.body.removeClass( 'qodef-fullscreen-menu--opened qodef-fullscreen-menu-animate--in' ).addClass( 'qodef-fullscreen-menu-animate--out' );
qodefCore.qodefScroll.enable();
$( 'nav.qodef-fullscreen-menu ul.sub_menu' ).slideUp( 200 );
},
clickItemWithChild: function ( thisItem ) {
var $thisItemParent = thisItem.parent(),
$thisItemSubMenu = $thisItemParent.find( '.sub-menu' ).first();
if ( $thisItemSubMenu.is( ':visible' ) ) {
$thisItemSubMenu.slideUp( 300 );
$thisItemParent.removeClass( 'qodef--opened' );
} else {
$thisItemSubMenu.slideDown( 300 );
$thisItemParent.addClass( 'qodef--opened' ).siblings().find( '.sub-menu' ).slideUp( 400 );
}
},
handleHeaderWidth: function ( state ) {
var $header = $( '#qodef-page-header' );
var $fullscreenMenuOpener = $( 'a.qodef-fullscreen-menu-opener' );
if ( $header.length && $fullscreenMenuOpener.length ) {
// if desktop device
if ( qodefCore.windowWidth > 1024 ) {
// if page height is greater then window height, scroll bar is visible
if ( qodefCore.body.height() > qodefCore.windowHeight ) {
// on resize reset previously set inline width
if ( 'resize' === state ) {
$header.css( { 'width': '' } );
}
$header.width( $header.width() );
}
} else {
// reset previously set inline width
$header.css( { 'width': '' } );
}
}
}
};
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefHeaderScrollAppearance.init();
}
);
var qodefHeaderScrollAppearance = {
appearanceType: function () {
return qodefCore.body.attr( 'class' ).indexOf( 'qodef-header-appearance--' ) !== -1 ? qodefCore.body.attr( 'class' ).match( /qodef-header-appearance--([\w]+)/ )[1] : '';
},
init: function () {
var appearanceType = this.appearanceType();
if ( appearanceType !== '' && appearanceType !== 'none' ) {
qodefCore[appearanceType + 'HeaderAppearance']();
}
}
};
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefMobileHeaderAppearance.init();
}
);
/*
** Init mobile header functionality
*/
var qodefMobileHeaderAppearance = {
init: function () {
if ( qodefCore.body.hasClass( 'qodef-mobile-header-appearance--sticky' ) ) {
var docYScroll1 = qodefCore.scroll,
displayAmount = qodefGlobal.vars.mobileHeaderHeight + qodefGlobal.vars.adminBarHeight,
$pageOuter = $( '#qodef-page-outer' );
qodefMobileHeaderAppearance.showHideMobileHeader( docYScroll1, displayAmount, $pageOuter );
$( window ).scroll(
function () {
qodefMobileHeaderAppearance.showHideMobileHeader( docYScroll1, displayAmount, $pageOuter );
docYScroll1 = qodefCore.scroll;
}
);
$( window ).resize(
function () {
$pageOuter.css( 'padding-top', 0 );
qodefMobileHeaderAppearance.showHideMobileHeader( docYScroll1, displayAmount, $pageOuter );
}
);
}
},
showHideMobileHeader: function ( docYScroll1, displayAmount, $pageOuter ) {
if ( qodefCore.windowWidth <= 1024 ) {
if ( qodefCore.scroll > displayAmount * 2 ) {
//set header to be fixed
qodefCore.body.addClass( 'qodef-mobile-header--sticky' );
//add transition to it
setTimeout(
function () {
qodefCore.body.addClass( 'qodef-mobile-header--sticky-animation' );
},
300
); //300 is duration of sticky header animation
//add padding to content so there is no 'jumping'
$pageOuter.css( 'padding-top', qodefGlobal.vars.mobileHeaderHeight );
} else {
//unset fixed header
qodefCore.body.removeClass( 'qodef-mobile-header--sticky' );
//remove transition
setTimeout(
function () {
qodefCore.body.removeClass( 'qodef-mobile-header--sticky-animation' );
},
300
); //300 is duration of sticky header animation
//remove padding from content since header is not fixed anymore
$pageOuter.css( 'padding-top', 0 );
}
if ( (qodefCore.scroll > docYScroll1 && qodefCore.scroll > displayAmount) || (qodefCore.scroll < displayAmount * 3) ) {
//show sticky header
qodefCore.body.removeClass( 'qodef-mobile-header--sticky-display' );
} else {
//hide sticky header
qodefCore.body.addClass( 'qodef-mobile-header--sticky-display' );
}
}
}
};
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefNavMenu.init();
}
);
var qodefNavMenu = {
init: function () {
qodefNavMenu.dropdownBehavior();
qodefNavMenu.wideDropdownPosition();
qodefNavMenu.dropdownPosition();
},
dropdownBehavior: function () {
var $menuItems = $( '.qodef-header-navigation > ul > li' );
$menuItems.each(
function () {
var $thisItem = $( this );
if ( $thisItem.find( '.qodef-drop-down-second' ).length ) {
qodef.qodefWaitForImages.check(
$thisItem,
function () {
var $dropdownHolder = $thisItem.find( '.qodef-drop-down-second' ),
$dropdownMenuItem = $dropdownHolder.find( '.qodef-drop-down-second-inner ul' ),
dropDownHolderHeight = $dropdownMenuItem.outerHeight();
if ( navigator.userAgent.match( /(iPod|iPhone|iPad)/ ) ) {
$thisItem.on(
'touchstart mouseenter',
function () {
$dropdownHolder.css(
{
'height': dropDownHolderHeight,
'overflow': 'visible',
'visibility': 'visible',
'opacity': '1',
}
);
}
).on(
'mouseleave',
function () {
$dropdownHolder.css(
{
'height': '0px',
'overflow': 'hidden',
'visibility': 'hidden',
'opacity': '0',
}
);
}
);
} else {
if ( qodefCore.body.hasClass( 'qodef-drop-down-second--animate-height' ) ) {
var animateConfig = {
interval: 0,
over: function () {
setTimeout(
function () {
$dropdownHolder.addClass( 'qodef-drop-down--start' ).css(
{
'visibility': 'visible',
'height': '0',
'opacity': '1',
}
);
$dropdownHolder.stop().animate(
{
'height': dropDownHolderHeight,
},
400,
'linear',
function () {
$dropdownHolder.css( 'overflow', 'visible' );
}
);
},
100
);
},
timeout: 100,
out: function () {
$dropdownHolder.stop().animate(
{
'height': '0',
'opacity': 0,
},
100,
function () {
$dropdownHolder.css(
{
'overflow': 'hidden',
'visibility': 'hidden',
}
);
}
);
$dropdownHolder.removeClass( 'qodef-drop-down--start' );
}
};
$thisItem.hoverIntent( animateConfig );
} else {
var config = {
interval: 0,
over: function () {
setTimeout(
function () {
$dropdownHolder.addClass( 'qodef-drop-down--start' ).stop().css( { 'height': dropDownHolderHeight } );
},
150
);
},
timeout: 150,
out: function () {
$dropdownHolder.stop().css( { 'height': '0' } ).removeClass( 'qodef-drop-down--start' );
}
};
$thisItem.hoverIntent( config );
}
}
}
);
}
}
);
},
wideDropdownPosition: function () {
var $menuItems = $( '.qodef-header-navigation > ul > li.qodef-menu-item--wide' );
if ( $menuItems.length ) {
$menuItems.each(
function () {
var $menuItem = $( this );
var $menuItemSubMenu = $menuItem.find( '.qodef-drop-down-second' );
if ( $menuItemSubMenu.length ) {
$menuItemSubMenu.css( 'left', 0 );
var leftPosition = $menuItemSubMenu.offset().left;
if ( qodefCore.body.hasClass( 'qodef--boxed' ) ) {
//boxed layout case
var boxedWidth = $( '.qodef--boxed #qodef-page-wrapper' ).outerWidth();
leftPosition = leftPosition - (qodefCore.windowWidth - boxedWidth) / 2;
$menuItemSubMenu.css( { 'left': -leftPosition, 'width': boxedWidth } );
} else if ( qodefCore.body.hasClass( 'qodef-drop-down-second--full-width' ) ) {
//wide dropdown full width case
$menuItemSubMenu.css( { 'left': -leftPosition, 'width': qodefCore.windowWidth } );
} else {
//wide dropdown in grid case
$menuItemSubMenu.css( { 'left': -leftPosition + (qodefCore.windowWidth - $menuItemSubMenu.width()) / 2 } );
}
}
}
);
}
},
dropdownPosition: function () {
var $menuItems = $( '.qodef-header-navigation > ul > li.qodef-menu-item--narrow.menu-item-has-children' );
if ( $menuItems.length ) {
$menuItems.each(
function () {
var $thisItem = $( this ),
menuItemPosition = $thisItem.offset().left,
$dropdownHolder = $thisItem.find( '.qodef-drop-down-second' ),
$dropdownMenuItem = $dropdownHolder.find( '.qodef-drop-down-second-inner ul' ),
dropdownMenuWidth = $dropdownMenuItem.outerWidth(),
menuItemFromLeft = $( window ).width() - menuItemPosition;
if ( qodef.body.hasClass( 'qodef--boxed' ) ) {
//boxed layout case
var boxedWidth = $( '.qodef--boxed #qodef-page-wrapper' ).outerWidth();
menuItemFromLeft = boxedWidth - menuItemPosition;
}
var dropDownMenuFromLeft;
if ( $thisItem.find( 'li.menu-item-has-children' ).length > 0 ) {
dropDownMenuFromLeft = menuItemFromLeft - dropdownMenuWidth;
}
$dropdownHolder.removeClass( 'qodef-drop-down--right' );
$dropdownMenuItem.removeClass( 'qodef-drop-down--right' );
if ( menuItemFromLeft < dropdownMenuWidth || dropDownMenuFromLeft < dropdownMenuWidth ) {
$dropdownHolder.addClass( 'qodef-drop-down--right' );
$dropdownMenuItem.addClass( 'qodef-drop-down--right' );
}
}
);
}
}
};
})( jQuery );
(function ( $ ) {
'use strict';
$( window ).on(
'load',
function () {
qodefParallaxBackground.init();
}
);
/**
* Init global parallax background functionality
*/
var qodefParallaxBackground = {
init: function ( settings ) {
this.$sections = $( '.qodef-parallax' );
// Allow overriding the default config
$.extend( this.$sections, settings );
var isSupported = ! qodefCore.html.hasClass( 'touchevents' ) && ! qodefCore.body.hasClass( 'qodef-browser--edge' ) && ! qodefCore.body.hasClass( 'qodef-browser--ms-explorer' );
if ( this.$sections.length && isSupported ) {
this.$sections.each(
function () {
qodefParallaxBackground.ready( $( this ) );
}
);
}
},
ready: function ( $section ) {
$section.$imgHolder = $section.find( '.qodef-parallax-img-holder' );
$section.$imgWrapper = $section.find( '.qodef-parallax-img-wrapper' );
$section.$img = $section.find( 'img.qodef-parallax-img' );
var h = $section.height(),
imgWrapperH = $section.$imgWrapper.height();
$section.movement = 100 * (imgWrapperH - h) / h / 2; //percentage (divided by 2 due to absolute img centering in CSS)
$section.buffer = window.pageYOffset;
$section.scrollBuffer = null;
//calc and init loop
requestAnimationFrame(
function () {
$section.$imgHolder.animate( { opacity: 1 }, 100 );
qodefParallaxBackground.calc( $section );
qodefParallaxBackground.loop( $section );
}
);
//recalc
$( window ).on(
'resize',
function () {
qodefParallaxBackground.calc( $section );
}
);
},
calc: function ( $section ) {
var wH = $section.$imgWrapper.height(),
wW = $section.$imgWrapper.width();
if ( $section.$img.width() < wW ) {
$section.$img.css(
{
'width': '100%',
'height': 'auto',
}
);
}
if ( $section.$img.height() < wH ) {
$section.$img.css(
{
'height': '100%',
'width': 'auto',
'max-width': 'unset',
}
);
}
},
loop: function ( $section ) {
if ( $section.scrollBuffer === Math.round( window.pageYOffset ) ) {
requestAnimationFrame(
function () {
qodefParallaxBackground.loop( $section );
}
); //repeat loop
return false; //same scroll value, do nothing
} else {
$section.scrollBuffer = Math.round( window.pageYOffset );
}
var wH = window.outerHeight,
sTop = $section.offset().top,
sH = $section.height();
if ( $section.scrollBuffer + wH * 1.2 > sTop && $section.scrollBuffer < sTop + sH ) {
var delta = (Math.abs( $section.scrollBuffer + wH - sTop ) / (wH + sH)).toFixed( 4 ), //coeff between 0 and 1 based on scroll amount
yVal = (delta * $section.movement).toFixed( 4 );
if ( $section.buffer !== delta ) {
$section.$imgWrapper.css( 'transform', 'translate3d(0,' + yVal + '%, 0)' );
}
$section.buffer = delta;
}
requestAnimationFrame(
function () {
qodefParallaxBackground.loop( $section );
}
); //repeat loop
}
};
qodefCore.qodefParallaxBackground = qodefParallaxBackground;
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefReview.init();
}
);
var qodefReview = {
init: function () {
var ratingHolder = $( '#qodef-page-comments-form .qodef-rating-inner' );
var addActive = function ( stars, ratingValue ) {
for ( var i = 0; i < stars.length; i++ ) {
var star = stars[i];
if ( i < ratingValue ) {
$( star ).addClass( 'active' );
} else {
$( star ).removeClass( 'active' );
}
}
};
ratingHolder.each(
function () {
var thisHolder = $( this ),
ratingInput = thisHolder.find( '.qodef-rating' ),
ratingValue = ratingInput.val(),
stars = thisHolder.find( '.qodef-star-rating' );
addActive( stars, ratingValue );
stars.on(
'click',
function () {
ratingInput.val( $( this ).data( 'value' ) ).trigger( 'change' );
}
);
ratingInput.change(
function () {
ratingValue = ratingInput.val();
addActive( stars, ratingValue );
}
);
}
);
}
};
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefSideArea.init();
}
);
var qodefSideArea = {
init: function () {
var $sideAreaOpener = $( 'a.qodef-side-area-opener' ),
$sideAreaClose = $( '#qodef-side-area-close' ),
$sideArea = $( '#qodef-side-area' );
qodefSideArea.openerHoverColor( $sideAreaOpener );
// Open Side Area
$sideAreaOpener.on(
'click',
function ( e ) {
e.preventDefault();
if ( ! qodefCore.body.hasClass( 'qodef-side-area--opened' ) ) {
qodefSideArea.openSideArea();
$( document ).keyup(
function ( e ) {
if ( e.keyCode === 27 ) {
qodefSideArea.closeSideArea();
}
}
);
} else {
qodefSideArea.closeSideArea();
}
}
);
$sideAreaClose.on(
'click',
function ( e ) {
e.preventDefault();
qodefSideArea.closeSideArea();
}
);
if ( $sideArea.length && typeof qodefCore.qodefPerfectScrollbar === 'object' ) {
qodefCore.qodefPerfectScrollbar.init( $sideArea );
}
},
openSideArea: function () {
var $wrapper = $( '#qodef-page-wrapper' );
var currentScroll = $( window ).scrollTop();
$( '.qodef-side-area-cover' ).remove();
$wrapper.prepend( '<div class="qodef-side-area-cover"/>' );
qodefCore.body.removeClass( 'qodef-side-area-animate--out' ).addClass( 'qodef-side-area--opened qodef-side-area-animate--in' );
$( '.qodef-side-area-cover' ).on(
'click',
function ( e ) {
e.preventDefault();
qodefSideArea.closeSideArea();
}
);
$( window ).scroll(
function () {
if ( Math.abs( qodefCore.scroll - currentScroll ) > 400 ) {
qodefSideArea.closeSideArea();
}
}
);
},
closeSideArea: function () {
qodefCore.body.removeClass( 'qodef-side-area--opened qodef-side-area-animate--in' ).addClass( 'qodef-side-area-animate--out' );
},
openerHoverColor: function ( $opener ) {
if ( typeof $opener.data( 'hover-color' ) !== 'undefined' ) {
var hoverColor = $opener.data( 'hover-color' );
var originalColor = $opener.css( 'color' );
$opener.on(
'mouseenter',
function () {
$opener.css( 'color', hoverColor );
}
).on(
'mouseleave',
function () {
$opener.css( 'color', originalColor );
}
);
}
}
};
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function() {
qodefSpinner.init();
}
);
$( window ).on(
'load',
function () {
qodefSpinner.windowLoaded = true;
if (document.visibilityState === 'visible') {
qodefSpinner.fadeOutLoader();
} else {
document.addEventListener("visibilitychange", function() {
if (document.visibilityState === 'visible') {
qodefSpinner.fadeOutLoader();
}
});
}
}
);
$( window ).on(
'elementor/frontend/init',
function () {
var isEditMode = Boolean( elementorFrontend.isEditMode() );
if ( isEditMode ) {
qodefSpinner.init( isEditMode );
}
}
);
var qodefSpinner = {
holder: '',
windowLoaded: false,
init: function ( isEditMode ) {
this.holder = $( '#qodef-page-spinner:not(.qodef--custom-spinner):not(.qodef-layout--textual)' );
if ( this.holder.length ) {
qodefSpinner.animateSpinner( isEditMode );
qodefSpinner.fadeOutAnimation();
}
},
animateSpinner: function ( isEditMode ) {
if ( isEditMode ) {
qodefSpinner.fadeOutLoader();
}
},
fadeOutLoader: function ( speed, delay, easing ) {
var $holder = qodefSpinner.holder.length ? qodefSpinner.holder : $( '#qodef-page-spinner:not(.qodef--custom-spinner):not(.qodef-layout--textual)' );
speed = speed ? speed : 600;
delay = delay ? delay : 0;
easing = easing ? easing : 'swing';
$holder.delay( delay ).fadeOut( speed, easing );
$( window ).on(
'bind',
'pageshow',
function ( event ) {
if ( event.originalEvent.persisted ) {
$holder.fadeOut( speed, easing );
}
}
);
},
fadeOutAnimation: function () {
// Check for fade out animation
if ( qodefCore.body.hasClass( 'qodef-spinner--fade-out' ) ) {
var $pageHolder = $( '#qodef-page-wrapper' ),
$linkItems = $( 'a' );
// If back button is pressed, than show content to avoid state where content is on display:none
window.addEventListener(
'pageshow',
function ( event ) {
var historyPath = event.persisted || (typeof window.performance !== 'undefined' && window.performance.navigation.type === 2);
if ( historyPath && ! $pageHolder.is( ':visible' ) ) {
$pageHolder.show();
}
}
);
$linkItems.on(
'click',
function ( e ) {
var $clickedLink = $( this );
if (
e.which === 1 && // check if the left mouse button has been pressed
$clickedLink.attr( 'href' ).indexOf( window.location.host ) >= 0 && // check if the link is to the same domain
! $clickedLink.hasClass( 'remove' ) && // check is WooCommerce remove link
$clickedLink.parent( '.product-remove' ).length <= 0 && // check is WooCommerce remove link
$clickedLink.parents( '.woocommerce-product-gallery__image' ).length <= 0 && // check is product gallery link
typeof $clickedLink.data( 'rel' ) === 'undefined' && // check pretty photo link
typeof $clickedLink.attr( 'rel' ) === 'undefined' && // check VC pretty photo link
! $clickedLink.hasClass( 'lightbox-active' ) && // check is lightbox plugin active
(typeof $clickedLink.attr( 'target' ) === 'undefined' || $clickedLink.attr( 'target' ) === '_self') && // check if the link opens in the same window
$clickedLink.attr( 'href' ).split( '#' )[0] !== window.location.href.split( '#' )[0] // check if it is an anchor aiming for a different page
) {
e.preventDefault();
$pageHolder.fadeOut(
600,
'easeOutSine',
function () {
window.location = $clickedLink.attr( 'href' );
}
);
}
}
);
}
}
};
qodefCore.qodefSpinner = qodefSpinner;
})( jQuery );
(function ( $ ) {
'use strict';
$( window ).on(
'load',
function () {
qodefSubscribeModal.init();
}
);
var qodefSubscribeModal = {
init: function () {
this.holder = $( '#qodef-subscribe-popup-modal' );
if ( this.holder.length ) {
var $preventHolder = this.holder.find( '.qodef-sp-prevent' ),
$modalClose = $( '.qodef-sp-close' ),
disabledPopup = 'no';
if ( $preventHolder.length ) {
var isLocalStorage = this.holder.hasClass( 'qodef-sp-prevent-cookies' ),
$preventInput = $preventHolder.find( '.qodef-sp-prevent-input' ),
preventValue = $preventInput.data( 'value' );
if ( isLocalStorage ) {
disabledPopup = localStorage.getItem( 'disabledPopup' );
sessionStorage.removeItem( 'disabledPopup' );
} else {
disabledPopup = sessionStorage.getItem( 'disabledPopup' );
localStorage.removeItem( 'disabledPopup' );
}
$preventHolder.children().on(
'click',
function ( e ) {
if ( preventValue !== 'yes' ) {
preventValue = 'yes';
$preventInput.addClass( 'qodef-sp-prevent-clicked' ).data( 'value', 'yes' );
} else {
preventValue = 'no';
$preventInput.removeClass( 'qodef-sp-prevent-clicked' ).data( 'value', 'no' );
}
if ( preventValue === 'yes' ) {
if ( isLocalStorage ) {
localStorage.setItem( 'disabledPopup', 'yes' );
} else {
sessionStorage.setItem( 'disabledPopup', 'yes' );
}
} else {
if ( isLocalStorage ) {
localStorage.setItem( 'disabledPopup', 'no' );
} else {
sessionStorage.setItem( 'disabledPopup', 'no' );
}
}
}
);
}
if ( disabledPopup !== 'yes' ) {
if ( qodefCore.body.hasClass( 'qodef-sp-opened' ) ) {
qodefSubscribeModal.handleClassAndScroll( 'remove' );
} else {
qodefSubscribeModal.handleClassAndScroll( 'add' );
}
$modalClose.on(
'click',
function ( e ) {
e.preventDefault();
qodefSubscribeModal.handleClassAndScroll( 'remove' );
}
);
// Close on escape
$( document ).keyup(
function ( e ) {
if ( e.keyCode === 27 ) { // KeyCode for ESC button is 27
qodefSubscribeModal.handleClassAndScroll( 'remove' );
}
}
);
}
}
},
handleClassAndScroll: function ( option ) {
if ( option === 'remove' ) {
qodefCore.body.removeClass( 'qodef-sp-opened' );
qodefCore.qodefScroll.enable();
}
if ( option === 'add' ) {
qodefCore.body.addClass( 'qodef-sp-opened' );
qodefCore.qodefScroll.disable();
}
},
};
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefWishlist.init();
}
);
/**
* Function object that represents wishlist area popup.
* @returns {{init: Function}}
*/
var qodefWishlist = {
init: function () {
var $wishlistLink = $( '.qodef-wishlist .qodef-m-link' );
if ( $wishlistLink.length ) {
$wishlistLink.each(
function () {
var $thisWishlistLink = $( this ),
wishlistIconHTML = $thisWishlistLink.html(),
$responseMessage = $thisWishlistLink.siblings( '.qodef-m-response' );
$thisWishlistLink.off().on(
'click',
function ( e ) {
e.preventDefault();
if ( qodefCore.body.hasClass( 'logged-in' ) ) {
var itemID = $thisWishlistLink.data( 'id' );
if ( itemID !== 'undefined' && ! $thisWishlistLink.hasClass( 'qodef--added' ) ) {
$thisWishlistLink.html( '<span class="fa fa-spinner fa-spin" aria-hidden="true"></span>' );
var wishlistData = {
type: 'add',
itemID: itemID,
};
$.ajax(
{
type: 'POST',
url: qodefGlobal.vars.restUrl + qodefGlobal.vars.wishlistRestRoute,
data: {
options: wishlistData,
},
beforeSend: function ( request ) {
request.setRequestHeader( 'X-WP-Nonce', qodefGlobal.vars.restNonce );
},
success: function ( response ) {
if ( response.status === 'success' ) {
$thisWishlistLink.addClass( 'qodef--added' );
$responseMessage.html( response.message ).addClass( 'qodef--show' ).fadeIn( 200 );
$( document ).trigger(
'hiroshi_core_wishlist_item_is_added',
[itemID, response.data.user_id]
);
} else {
$responseMessage.html( response.message ).addClass( 'qodef--show' ).fadeIn( 200 );
}
setTimeout(
function () {
$thisWishlistLink.html( wishlistIconHTML );
var $wishlistTitle = $thisWishlistLink.find( '.qodef-m-link-label' );
if ( $wishlistTitle.length ) {
$wishlistTitle.text( $wishlistTitle.data( 'added-title' ) );
}
$responseMessage.fadeOut( 300 ).removeClass( 'qodef--show' ).empty();
},
800
);
}
}
);
}
} else {
// Trigger event.
$( document.body ).trigger( 'hiroshi_membership_trigger_login_modal' );
}
}
);
}
);
}
}
};
$( document ).on(
'hiroshi_core_wishlist_item_is_removed',
function ( e, removedItemID ) {
var $wishlistLink = $( '.qodef-wishlist .qodef-m-link' );
if ( $wishlistLink.length ) {
$wishlistLink.each(
function () {
var $thisWishlistLink = $( this ),
$wishlistTitle = $thisWishlistLink.find( '.qodef-m-link-label' );
if ( $thisWishlistLink.data( 'id' ) === removedItemID && $thisWishlistLink.hasClass( 'qodef--added' ) ) {
$thisWishlistLink.removeClass( 'qodef--added' );
if ( $wishlistTitle.length ) {
$wishlistTitle.text( $wishlistTitle.data( 'title' ) );
}
}
}
);
}
}
);
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.hiroshi_core_accordion = {};
$( document ).ready(
function () {
qodefAccordion.init();
}
);
var qodefAccordion = {
init: function () {
var $holder = $( '.qodef-accordion' );
if ( $holder.length ) {
$holder.each(
function () {
qodefAccordion.initItem( $( this ) );
}
);
}
},
initItem: function ( $currentItem ) {
if ( $currentItem.hasClass( 'qodef-behavior--accordion' ) ) {
qodefAccordion.initAccordion( $currentItem );
}
if ( $currentItem.hasClass( 'qodef-behavior--toggle' ) ) {
qodefAccordion.initToggle( $currentItem );
}
$currentItem.addClass( 'qodef--init' );
},
initAccordion: function ( $accordion ) {
$accordion.accordion(
{
animate: 'swing',
collapsible: true,
active: 0,
icons: '',
heightStyle: 'content',
}
);
},
initToggle: function ( $toggle ) {
var $toggleAccordionTitle = $toggle.find( '.qodef-accordion-title' );
$toggleAccordionTitle.off().on(
'mouseenter',
function () {
$( this ).addClass( 'ui-state-hover' );
}
).on(
'mouseleave',
function () {
$( this ).removeClass( 'ui-state-hover' );
}
).on(
'click',
function ( e ) {
e.preventDefault();
e.stopImmediatePropagation();
var $thisTitle = $( this );
if ( $thisTitle.hasClass( 'ui-state-active' ) ) {
$thisTitle.removeClass( 'ui-state-active' );
$thisTitle.next().removeClass( 'ui-accordion-content-active' ).slideUp( 300 );
} else {
$thisTitle.addClass( 'ui-state-active' );
$thisTitle.next().addClass( 'ui-accordion-content-active' ).slideDown( 400 );
}
}
);
}
};
qodefCore.shortcodes.hiroshi_core_accordion.qodefAccordion = qodefAccordion;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.hiroshi_core_button = {};
$( document ).ready(
function () {
qodefButton.init();
}
);
var qodefButton = {
init: function () {
this.buttons = $( '.qodef-button' );
if ( this.buttons.length ) {
this.buttons.each(
function () {
qodefButton.initItem( $( this ) );
}
);
}
},
initItem: function ( $currentItem ) {
qodefButton.buttonHoverColor( $currentItem );
// qodefButton.buttonHoverBgColor( $currentItem );
qodefButton.buttonHoverBorderColor( $currentItem );
},
buttonHoverColor: function ( $button ) {
if ( typeof $button.data( 'hover-color' ) !== 'undefined' ) {
var hoverColor = $button.data( 'hover-color' );
var originalColor = $button.css( 'color' );
$button.on(
'mouseenter touchstart',
function () {
qodefButton.changeColor( $button, 'color', hoverColor );
}
);
$button.on(
'mouseleave touchend',
function () {
qodefButton.changeColor( $button, 'color', originalColor );
}
);
}
},
buttonHoverBgColor: function ( $button ) {
if ( typeof $button.data( 'hover-background-color' ) !== 'undefined' ) {
var hoverBackgroundColor = $button.data( 'hover-background-color' );
var originalBackgroundColor = $button.css( 'background-color' );
$button.on(
'mouseenter touchstart',
function () {
qodefButton.changeColor( $button, 'background-color', hoverBackgroundColor );
}
);
$button.on(
'mouseleave touchend',
function () {
qodefButton.changeColor( $button, 'background-color', originalBackgroundColor );
}
);
}
},
buttonHoverBorderColor: function ( $button ) {
if ( typeof $button.data( 'hover-border-color' ) !== 'undefined' ) {
var hoverBorderColor = $button.data( 'hover-border-color' );
var originalBorderColor = $button.css( 'borderTopColor' );
$button.on(
'mouseenter touchstart',
function () {
qodefButton.changeColor( $button, 'border-color', hoverBorderColor );
}
);
$button.on(
'mouseleave touchend',
function () {
qodefButton.changeColor( $button, 'border-color', originalBorderColor );
}
);
}
},
changeColor: function ( $button, cssProperty, color ) {
$button.css( cssProperty, color );
}
};
qodefCore.shortcodes.hiroshi_core_button.qodefButton = qodefButton;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.hiroshi_core_countdown = {};
$( document ).ready(
function () {
qodefCountdown.init();
}
);
var qodefCountdown = {
init: function () {
this.countdowns = $( '.qodef-countdown' );
if ( this.countdowns.length ) {
this.countdowns.each(
function () {
qodefCountdown.initItem( $( this ) );
}
);
}
},
initItem: function ( $currentItem ) {
var $countdownElement = $currentItem.find( '.qodef-m-date' ),
dateFormats = ['week', 'day', 'hour', 'minute', 'second'],
options = qodefCountdown.generateOptions( $currentItem, dateFormats );
qodefCountdown.initCountdown( $countdownElement, options, dateFormats );
},
generateOptions: function ( $countdown, dateFormats ) {
var options = {};
options.date = typeof $countdown.data( 'date' ) !== 'undefined' ? $countdown.data( 'date' ) : null;
for ( var i = 0; i < dateFormats.length; i++ ) {
var label = dateFormats[i] + 'Label',
labelPlural = dateFormats[i] + 'LabelPlural';
options[label] = typeof $countdown.data( dateFormats[i] + '-label' ) !== 'undefined' ? $countdown.data( dateFormats[i] + '-label' ) : '';
options[labelPlural] = typeof $countdown.data( dateFormats[i] + '-label-plural' ) !== 'undefined' ? $countdown.data( dateFormats[i] + '-label-plural' ) : '';
}
return options;
},
initCountdown: function ( $countdownElement, options, dateFormats ) {
var countDownDate = new Date( options.date ).getTime();
// Update the count down every 1 second
var x = setInterval(
function () {
// Get today's date and time
var now = new Date().getTime();
// Find the distance between now and the count down date
var distance = countDownDate - now;
// Time calculations for days, hours, minutes and seconds
this.weeks = Math.floor( distance / (1000 * 60 * 60 * 24 * 7) );
this.days = Math.floor( (distance % (1000 * 60 * 60 * 24 * 7)) / (1000 * 60 * 60 * 24) );
this.hours = Math.floor( (distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60) );
this.minutes = Math.floor( (distance % (1000 * 60 * 60)) / (1000 * 60) );
this.seconds = Math.floor( (distance % (1000 * 60)) / 1000 );
for ( var i = 0; i < dateFormats.length; i++ ) {
var dateName = dateFormats[i] + 's';
qodefCountdown.initiateDate( $countdownElement, this[dateName], dateFormats[i], options );
}
// If the count down is finished, write some text
if ( distance < 0 ) {
clearInterval( x );
qodefCountdown.afterClearInterval( $countdownElement, dateFormats, options );
}
},
1000
);
},
initiateDate: function ( $countdownElement, date, dateFormat, options ) {
var $holder = $countdownElement.find( '.qodef-' + dateFormat + 's' );
$holder.find( '.qodef-label' ).html( ( 1 === date ) ? options[dateFormat + 'Label'] : options[dateFormat + 'LabelPlural'] );
date = (date < 10) ? '0' + date : date;
$holder.find( '.qodef-digit' ).html( date );
},
afterClearInterval: function( $countdownElement, dateFormats, options ) {
for ( var i = 0; i < dateFormats.length; i++ ) {
var $holder = $countdownElement.find( '.qodef-' + dateFormats[i] + 's' );
$holder.find( '.qodef-label' ).html( options[dateFormats[i] + 'LabelPlural'] );
$holder.find( '.qodef-digit' ).html( '00' );
}
}
};
qodefCore.shortcodes.hiroshi_core_countdown.qodefCountdown = qodefCountdown;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.hiroshi_core_counter = {};
$( document ).ready(
function () {
qodefCounter.init();
}
);
var qodefCounter = {
init: function () {
this.counters = $( '.qodef-counter' );
if ( this.counters.length ) {
this.counters.each(
function () {
qodefCounter.initItem( $( this ) );
}
);
}
},
initItem: function ( $currentItem ) {
var $counterElement = $currentItem.find( '.qodef-m-digit' ),
options = qodefCounter.generateOptions( $currentItem );
qodefCore.qodefIsInViewport.check(
$currentItem,
function () {
qodefCounter.counterScript( $counterElement, options );
},
false
);
},
generateOptions: function ( $counter ) {
var options = {};
options.start = typeof $counter.data( 'start-digit' ) !== 'undefined' && $counter.data( 'start-digit' ) !== '' ? $counter.data( 'start-digit' ) : 0;
options.end = typeof $counter.data( 'end-digit' ) !== 'undefined' && $counter.data( 'end-digit' ) !== '' ? $counter.data( 'end-digit' ) : null;
options.step = typeof $counter.data( 'step-digit' ) !== 'undefined' && $counter.data( 'step-digit' ) !== '' ? $counter.data( 'step-digit' ) : 1;
options.delay = typeof $counter.data( 'step-delay' ) !== 'undefined' && $counter.data( 'step-delay' ) !== '' ? parseInt( $counter.data( 'step-delay' ), 10 ) : 100;
options.txt = typeof $counter.data( 'digit-label' ) !== 'undefined' && $counter.data( 'digit-label' ) !== '' ? $counter.data( 'digit-label' ) : '';
return options;
},
counterScript: function ( $counterElement, options ) {
var defaults = {
start: 0,
end: null,
step: 1,
delay: 50,
txt: '',
};
var settings = $.extend( defaults, options || {} );
var nb_start = settings.start;
var nb_end = settings.end;
$counterElement.text( nb_start + settings.txt );
// Timer
// Launches every "settings.delay"
var counterInterval = setInterval(
function () {
// Definition of conditions of arrest
if ( nb_end !== null && nb_start >= nb_end ) {
return;
}
// incrementation
nb_start = nb_start + settings.step;
// Check is ended
if ( nb_start >= nb_end ) {
nb_start = nb_end;
clearInterval( counterInterval );
}
// display
$counterElement.text( parseFloat(nb_start).toLocaleString() + settings.txt );
},
settings.delay
);
}
};
qodefCore.shortcodes.hiroshi_core_counter.qodefCounter = qodefCounter;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.hiroshi_core_frame_slider = {};
$( document ).ready(
function () {
qodefFrameSlider.init();
}
);
var qodefFrameSlider = {
init: function () {
this.holder = $( '.qodef-frame-slider-holder' );
if ( this.holder.length ) {
this.holder.each(
function () {
qodefFrameSlider.initItem( $( this ) );
}
);
}
},
initItem: function ( $holder ) {
var $swiperHolder = $holder.find( '.qodef-m-swiper' ),
$sliderHolder = $holder.find( '.qodef-m-items' ),
$section = $holder.closest('.elementor-section');
var $swiper = new Swiper(
$swiperHolder,
{
slidesPerView: 1,
centeredSlides: true,
spaceBetween: 0,
autoplay: true,
loop: true,
speed: 1200,
effect: 'fade',
fadeEffect : {
crossFade: true
},
on: {
init: function () {
setTimeout(
function () {
$sliderHolder.addClass( 'qodef-swiper--initialized' );
},
1500
);
},
slideChangeTransitionStart : function () {
var active = $holder.find('.swiper-slide-active'),
background = active.data('background-color');
if ( background ) {
$section.css( 'transition', 'background-color 1s ease-out' );
$section.css( 'background-color', background );
} else {
$section.css( 'background-color', 'transparent' );
}
}
},
}
);
}
};
qodefCore.shortcodes.hiroshi_core_frame_slider.qodefFrameSlider = qodefFrameSlider;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.hiroshi_core_fullscreen_tabs = {};
$( document ).ready(
function () {
qodefFullscreenTabs.init();
}
);
var qodefFullscreenTabs = {
init: function () {
this.holder = $( '.qodef-fullscreen-tabs' );
if ( this.holder.length ) {
this.holder.each(
function () {
qodefFullscreenTabs.initItem( $( this ) );
}
);
}
},
initItem: function ( $holder ) {
var $holderWidth = $holder.outerWidth(),
$tab = $holder.find( '.qodef-m-tab' ),
$tabContent = $holder.find( '.qodef-m-content' ),
$tabContentInner = $holder.find( '.qodef-e-content-inner' ),
$tabWrapper = $holder.find( '.qodef-tab-wrapper' ),
$tabWidth = $tab.outerWidth(),
$tabHeight = $holder.find( '.qodef-m-title-vertical' ).innerHeight(),
$header = $('#qodef-page-header'),
$headerHeight = $header.innerHeight(),
$mobileHeight = $('#qodef-page-mobile-header').innerHeight(),
$widthModifier = qodefCore.windowWidth > 1280 ? '70px' : '0px';
if ( qodefCore.windowWidth > 1024 ) {
$holder.css( 'height', '66vh' );
}
//$tab.last().addClass('active-tab');
if ( qodefCore.windowWidth > 768 ) {
$tab.last().addClass('active-tab');
$tab.last().css( 'width', 'calc(' + $holderWidth + 'px + 70px - ' + $tabWidth*( $tab.length - 1 ) + 'px)' );
$tabWrapper.css( 'width', 'calc(' + $holderWidth + 'px + 70px - ' + $tabWidth*( $tab.length ) + 'px)' );
$tabContent.css( 'width', 'calc(' + $holderWidth + 'px + 70px - ' + $tabWidth*( $tab.length ) + 'px)' );
$tabContent.css( 'right', -$tabWidth + 'px' );
$header.css( 'width', '100%' );
$tab.each(
function () {
var $this = $( this );
$this.on(
'click',
function () {
$this.siblings().removeClass('active-tab');
$this.siblings().css('width', $tabWidth );
$this.addClass('active-tab');
$this.css('width', 'calc(' + $holderWidth + 'px + '+ $widthModifier +' - ' + $tabWidth*($tab.length - 1 ) + 'px)' );
}
);
}
);
} else {
//$tabContent.css( 'height', 'calc(100vh - ' + $tabHeight + 'px)' );
//$tab.last().css( 'height', $tabContent.innerHeight() + $tabHeight );
$tabContent.css( 'top', $tabHeight );
$tabWrapper.css( 'height', $tabHeight );
$tab.each(
function () {
var $this = $( this );
$this.on(
'click',
function () {
var $thisContent = $this.find('.qodef-m-content');
$this.siblings().removeClass('active-tab');
$this.siblings().css('height', $tabHeight );
$this.addClass('active-tab');
$this.css('height', $thisContent.innerHeight() + $tabHeight );
}
);
}
);
}
}
};
qodefCore.shortcodes.hiroshi_core_fullscreen_tabs.qodefFullscreenTabs = qodefFullscreenTabs;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.hiroshi_core_google_map = {};
$( document ).ready(
function () {
qodefGoogleMap.init();
}
);
var qodefGoogleMap = {
init: function () {
this.holder = $( '.qodef-google-map' );
if ( this.holder.length ) {
this.holder.each(
function () {
qodefGoogleMap.initItem( $( this ) );
}
);
}
},
initItem: function ( $currentItem ) {
if ( typeof window.qodefGoogleMap !== 'undefined' ) {
window.qodefGoogleMap.init( $currentItem.find( '.qodef-m-map' ) );
}
},
};
qodefCore.shortcodes.hiroshi_core_google_map.qodefGoogleMap = qodefGoogleMap;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.hiroshi_core_icon = {};
$( document ).ready(
function () {
qodefIcon.init();
}
);
var qodefIcon = {
init: function () {
this.icons = $( '.qodef-icon-holder' );
if ( this.icons.length ) {
this.icons.each(
function () {
qodefIcon.initItem( $( this ) );
}
);
}
},
initItem: function ( $currentItem ) {
qodefIcon.iconHoverColor( $currentItem );
qodefIcon.iconHoverBgColor( $currentItem );
qodefIcon.iconHoverBorderColor( $currentItem );
},
iconHoverColor: function ( $iconHolder ) {
if ( typeof $iconHolder.data( 'hover-color' ) !== 'undefined' ) {
var spanHolder = $iconHolder.find( 'span' ).length ? $iconHolder.find( 'span' ) : $iconHolder;
var originalColor = spanHolder.css( 'color' );
var hoverColor = $iconHolder.data( 'hover-color' );
$iconHolder.on(
'mouseenter',
function () {
qodefIcon.changeColor(
spanHolder,
'color',
hoverColor
);
}
);
$iconHolder.on(
'mouseleave',
function () {
qodefIcon.changeColor(
spanHolder,
'color',
originalColor
);
}
);
}
},
iconHoverBgColor: function ( $iconHolder ) {
if ( typeof $iconHolder.data( 'hover-background-color' ) !== 'undefined' ) {
var hoverBackgroundColor = $iconHolder.data( 'hover-background-color' );
var originalBackgroundColor = $iconHolder.css( 'background-color' );
$iconHolder.on(
'mouseenter',
function () {
qodefIcon.changeColor(
$iconHolder,
'background-color',
hoverBackgroundColor
);
}
);
$iconHolder.on(
'mouseleave',
function () {
qodefIcon.changeColor(
$iconHolder,
'background-color',
originalBackgroundColor
);
}
);
}
},
iconHoverBorderColor: function ( $iconHolder ) {
if ( typeof $iconHolder.data( 'hover-border-color' ) !== 'undefined' ) {
var hoverBorderColor = $iconHolder.data( 'hover-border-color' );
var originalBorderColor = $iconHolder.css( 'borderTopColor' );
$iconHolder.on(
'mouseenter',
function () {
qodefIcon.changeColor(
$iconHolder,
'border-color',
hoverBorderColor
);
}
);
$iconHolder.on(
'mouseleave',
function () {
qodefIcon.changeColor(
$iconHolder,
'border-color',
originalBorderColor
);
}
);
}
},
changeColor: function ( iconElement, cssProperty, color ) {
iconElement.css(
cssProperty,
color
);
}
};
qodefCore.shortcodes.hiroshi_core_icon.qodefIcon = qodefIcon;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.hiroshi_core_image_gallery = {};
$( document ).ready(
function () {
qodefImageGalleryFixHeight.init();
}
);
var qodefImageGalleryFixHeight = {
init: function () {
var $slider = $( '.qodef-image-gallery.qodef-slider-type--image-zoom' );
if ( $slider.length ) {
$slider.each(function () {
// qodefImageGalleryFixHeight.setHeight( $( this ) );
qodefImageGalleryFixHeight.update( $( this ) );
});
}
},
setHeight: function ( $slider ) {
var images = $.makeArray( $slider.find('.swiper-slide') ),
maxHeight = 0;
maxHeight = images.reduce( ( prev, curr ) => {
return prev.offsetHeight >= curr.offsetHeight ? prev.offsetHeight : curr.offsetHeight;
}, 0 );
$(images).each(function () {
$(this).height(maxHeight*1.52);
});
},
update: function ( $slider ) {
var sliderOptions = $slider[0].swiper.params;
$slider[0].swiper.autoplay.stop();
sliderOptions.slidesPerView = 'auto';
sliderOptions.breakpoints = {
0: {
slidesPerView: 1.5,
},
// when window width is >= 481px
481: {
slidesPerView: 1.5,
},
// when window width is >= 681px
681: {
slidesPerView: 1.5,
},
// when window width is >= 769px
769: {
slidesPerView: 2,
},
// when window width is >= 1025px
1025: {
slidesPerView: 'auto'
},
// when window width is >= 1367px
1367: {
slidesPerView: 'auto'
},
// when window width is >= 1441px
1441: {
slidesPerView: 'auto'
}
}
$slider[0].swiper.destroy();
sliderOptions.loopedSlides = $slider.find('.qodef-e').length;
sliderOptions.loopedSlidesslidesPerGroupAuto = true;
var $modifiedSlider = new Swiper( sliderOptions.el, sliderOptions);
qodef.windowWidth > 1024 && qodefImageGalleryFixHeight.setHeight( $slider );
$modifiedSlider.autoplay.stop();
$modifiedSlider.update();
$modifiedSlider.autoplay.start();
},
};
qodefCore.shortcodes.hiroshi_core_image_gallery.qodefImageGalleryFixHeight = qodefImageGalleryFixHeight;
qodefCore.shortcodes.hiroshi_core_image_gallery.qodefSwiper = qodef.qodefSwiper;
qodefCore.shortcodes.hiroshi_core_image_gallery.qodefMasonryLayout = qodef.qodefMasonryLayout;
qodefCore.shortcodes.hiroshi_core_image_gallery.qodefMagnificPopup = qodef.qodefMagnificPopup;
qodefCore.shortcodes.hiroshi_core_image_gallery.qodefDragCursor = qodefCore.qodefDragCursor;
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefImageHotspots.init();
}
);
var qodefImageHotspots = {
init: function () {
this.holder = $( '.qodef-image-hotspots' );
if ( this.holder.length ) {
this.holder.each(
function () {
var $holder = $( this ),
$info = $holder.find('.qodef-e-content'),
$rightEdge = $holder.offset().left + $holder.width();
if ( $info.length ) {
Array.from($info).map(item => {
var $item = $(item);
if ( $item.offset().left + $item.width() > $rightEdge ) {
$item.css('left', 'auto').css('right', '100%');
if ( qodefCore.windowWidth <= 680 ) {
$item.find('.qodef-e-title').css('padding', '5px 20px 5px 0');
}
}
});
}
}
);
}
},
};
qodefCore.shortcodes.hiroshi_core_image_hotspots = {};
qodefCore.shortcodes.hiroshi_core_image_hotspots.qodefImageHotspots = qodefImageHotspots;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.hiroshi_core_image_marquee = {};
$( window ).load(
function () {
qodefImageMarquee.init();
}
);
var qodefImageMarquee = {
init: function () {
this.holder = $( '.qodef-image-marquee.qodef--move-on-scroll' );
if ( this.holder.length ) {
this.holder.each(
function (i) {
qodefImageMarquee.moveOnScroll( $( this ) , i );
}
);
}
},
moveOnScroll: function ( $currentItem , i) {
var $moveWrapper = $currentItem.find( '.qodef-m-content' ),
widthDiff = $moveWrapper.width() - $currentItem.width(),
move = Math.min( 300, widthDiff ),
shouldMoveRight = i % 2 !== 0;
move = shouldMoveRight ? move : -1 * move
shouldMoveRight && $currentItem.addClass( 'qodef--marquee-right' );
gsap.registerPlugin( ScrollTrigger );
const tl = gsap.timeline(
{defaults: {duration: 1},
scrollTrigger: {
trigger: $currentItem,
scrub: 1.5,
start: "top bottom",
end: "bottom top",
}
}
);
tl
.fromTo(
$moveWrapper,
{
x: 0,
rotate: 0.001,
},
{
x: move,
},
)
}
};
qodefCore.shortcodes.hiroshi_core_image_marquee.qodefImageMarquee = qodefImageMarquee;
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefImageWithTextAppear.init();
}
);
var qodefImageWithTextAppear = {
init: function () {
this.holder = $( '.qodef-image-with-text.qodef--has-appear' );
if ( this.holder.length ) {
this.holder.each(
function (i) {
var $holder = $( this );
qodefImageWithTextAppear.appear(i, $holder);
}
);
}
},
appear: function(i, $holder){
var tl = gsap.timeline(
{
paused: true,
}
);
tl
.from (
$holder,
{
'--qodef-clip': '100',
duration: 1.4,
ease: 'power3.inOut',
delay: ()=>{
var delay;
if ( i < 4) {
delay = i % 4 * .2;
} else {
delay = i % 2 * .2;
}
return delay;
}
},
)
qodefCore.qodefIsInViewport.check(
$($holder),
()=>{
qodef.qodefWaitForImages.check(
$($holder),
function(){
tl.play();
}
)
}
);
}
};
qodefCore.shortcodes.hiroshi_core_image_with_text = {};
qodefCore.shortcodes.hiroshi_core_image_with_text.qodefMagnificPopup = qodef.qodefMagnificPopup;
qodefCore.shortcodes.hiroshi_core_image_with_text.qodefImageWithTextAppear = qodefImageWithTextAppear;
})( jQuery );
(function ( $ ) {
'use strict';
$( window ).on(
'load',
function () {
qodefInfoSlider.init();
}
);
var qodefInfoSlider = {
init: function ( settings ) {
var $slider = $('.qodef-info-slider .qodef-images');
if ( $slider.length ) {
$slider.each(function () {
// Allow overriding the default config
$.extend($slider, settings);
qodefInfoSlider.createSlider( $( this ) );
});
}
},
createSlider: function ($slider) {
var options = qodefInfoSlider.getOptions($slider),
events = qodefInfoSlider.getEvents($slider, options),
$swiperHolder = $slider.find('.qodef-swiper-container-custom');
var $swiper = new Swiper($swiperHolder, Object.assign(options, events));
},
getOptions: function ($slider) {
var sliderOptions = typeof $slider.data( 'options' ) !== 'undefined' ? $slider.data( 'options' ) : {},
loopedSlides = sliderOptions.loopedSlides !== undefined && sliderOptions.loopedSlides !== '' ? sliderOptions.loopedSlides : 6;
var options = {
slidesPerView: 1,
loop: true,
loopedSlides: loopedSlides,
centeredSlides: false,
speed: 800,
navigation: { nextEl: $slider.find( '.swiper-button-next' ), prevEl: $slider.find( '.swiper-button-prev' ) },
autoplay: {
disableOnInteraction: false,
},
};
return Object.assign(options, qodefInfoSlider.getSliderData($slider));
},
getEvents: function ($slider, options) {
return {
on: {
slideChangeTransitionStart: function() {
var activeSlide = $slider.find('.swiper-slide-active'),
$items = $slider.parent().find('.qodef-e-info-bottom .qodef-e-item'),
activeIndex = activeSlide.data('swiper-slide-index');
$items.each( function () {
var item = $(this);
if (item.data('index') === activeIndex ) {
item.addClass('qodef--active');
} else {
item.removeClass('qodef--active');
}
});
},
init: function () {
var activeSlide = $slider.find('.swiper-slide-active'),
$items = $slider.parent().find('.qodef-e-info-bottom .qodef-e-item'),
activeIndex = activeSlide.data('swiper-slide-index');
$items.each( function () {
var item = $(this);
if (item.data('index') === activeIndex ) {
item.addClass('qodef--active');
} else {
item.removeClass('qodef--active');
}
});
}
}
};
},
getSliderData: function ($slider) {
var dataList = $slider.data(),
returnValue = {};
for (var property in dataList) {
if (dataList.hasOwnProperty(property)) {
// It's required to be different from data options because da options are all options from shortcode element
if (property !== 'options' && typeof dataList[property] !== 'undefined' && dataList[property] !== '') {
returnValue[property] = dataList[property];
}
}
}
return returnValue;
},
};
qodefCore.shortcodes.hiroshi_core_info_slider = {};
qodefCore.shortcodes.hiroshi_core_info_slider.qodefSwiper = qodef.qodefSwiper;
qodefCore.shortcodes.hiroshi_core_info_slider.qodefInfoSlider = qodefInfoSlider;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.hiroshi_core_interactive_link_showcase = {};
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.hiroshi_core_progress_bar = {};
$( document ).ready(
function () {
qodefProgressBar.init();
}
);
/**
* Init progress bar shortcode functionality
*/
var qodefProgressBar = {
init: function () {
this.holder = $( '.qodef-progress-bar' );
if ( this.holder.length ) {
this.holder.each(
function () {
qodefProgressBar.initItem( $( this ) );
}
);
}
},
initItem: function ( $currentItem ) {
var layout = $currentItem.data( 'layout' );
qodefCore.qodefIsInViewport.check(
$currentItem,
function () {
$currentItem.addClass( 'qodef--init' );
var $container = $currentItem.find( '.qodef-m-canvas' ),
data = qodefProgressBar.generateBarData( $currentItem, layout ),
number = $currentItem.data( 'number' ) / 100;
switch (layout) {
case 'circle':
qodefProgressBar.initCircleBar( $container, data, number );
break;
case 'semi-circle':
qodefProgressBar.initSemiCircleBar( $container, data, number );
break;
case 'line':
data = qodefProgressBar.generateLineData( $currentItem, number );
qodefProgressBar.initLineBar( $container, data );
break;
case 'custom':
qodefProgressBar.initCustomBar( $container, data, number );
break;
}
},
false
);
},
generateBarData: function ( thisBar, layout ) {
var activeWidth = thisBar.data( 'active-line-width' );
var activeColor = thisBar.data( 'active-line-color' );
var inactiveWidth = thisBar.data( 'inactive-line-width' );
var inactiveColor = thisBar.data( 'inactive-line-color' );
var easing = 'linear';
var duration = typeof thisBar.data( 'duration' ) !== 'undefined' && thisBar.data( 'duration' ) !== '' ? parseInt( thisBar.data( 'duration' ), 10 ) : 1600;
var textColor = thisBar.data( 'text-color' );
return {
strokeWidth: activeWidth,
color: activeColor,
trailWidth: inactiveWidth,
trailColor: inactiveColor,
easing: easing,
duration: duration,
svgStyle: {
width: '100%',
height: '100%'
},
text: {
style: {
color: textColor
},
autoStyleContainer: false
},
from: {
color: inactiveColor
},
to: {
color: activeColor
},
step: function ( state, bar ) {
if ( layout !== 'custom' ) {
bar.setText( Math.round( bar.value() * 100 ) + '%' );
}
},
};
},
generateLineData: function ( thisBar, number ) {
var height = thisBar.data( 'active-line-width' );
var activeColor = thisBar.data( 'active-line-color' );
var inactiveHeight = thisBar.data( 'inactive-line-width' );
var inactiveColor = thisBar.data( 'inactive-line-color' );
var duration = typeof thisBar.data( 'duration' ) !== 'undefined' && thisBar.data( 'duration' ) !== '' ? parseInt( thisBar.data( 'duration' ), 10 ) : 1600;
var textColor = thisBar.data( 'text-color' );
return {
percentage: number * 100,
duration: duration,
fillBackgroundColor: activeColor,
backgroundColor: inactiveColor,
height: height,
inactiveHeight: inactiveHeight,
followText: thisBar.hasClass( 'qodef-percentage--floating' ),
textColor: textColor,
};
},
initCircleBar: function ( $container, data, number ) {
if ( qodefProgressBar.checkBar( $container ) ) {
var $bar = new ProgressBar.Circle( $container[0], data );
$bar.animate( number );
}
},
initSemiCircleBar: function ( $container, data, number ) {
if ( qodefProgressBar.checkBar( $container ) ) {
var $bar = new ProgressBar.SemiCircle( $container[0], data );
$bar.animate( number );
}
},
initCustomBar: function ( $container, data, number ) {
if ( qodefProgressBar.checkBar( $container ) ) {
var $bar = new ProgressBar.Path( $container[0], data );
$bar.set( 0 );
$bar.animate( number );
}
},
initLineBar: function ( $container, data ) {
$container.LineProgressbar( data );
},
checkBar: function ( $container ) {
// check if svg is already in container, elementor fix
if ( $container.find( 'svg' ).length ) {
return false;
}
return true;
}
};
qodefCore.shortcodes.hiroshi_core_progress_bar.qodefProgressBar = qodefProgressBar;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.hiroshi_core_tabs = {};
$( document ).ready(
function () {
qodefTabs.init();
}
);
var qodefTabs = {
init: function () {
this.holder = $( '.qodef-tabs' );
if ( this.holder.length ) {
this.holder.each(
function () {
qodefTabs.initItem( $( this ) );
}
);
}
},
initItem: function ( $currentItem ) {
$currentItem.children( '.qodef-tabs-content' ).each(
function ( index ) {
index = index + 1;
var $that = $( this ),
link = $that.attr( 'id' ),
$navItem = $that.parent().find( '.qodef-tabs-navigation li:nth-child(' + index + ') a' ),
navLink = $navItem.attr( 'href' );
link = '#' + link;
if ( link.indexOf( navLink ) > -1 ) {
$navItem.attr(
'href',
link
);
}
}
);
$currentItem.addClass( 'qodef--init' ).tabs();
},
setHeight ( $holder ) {
var $navigation = $holder.find( '.qodef-tabs-navigation' ),
$content = $holder.find( '.qodef-tabs-content' ),
navHeight,
contentHeight,
maxContentHeight = 0;
if ( $navigation.length ) {
navHeight = $navigation.outerHeight( true );
}
if ( $content.length ) {
$content.each(
function () {
contentHeight = $( this ).outerHeight( true );
maxContentHeight = contentHeight > maxContentHeight ? contentHeight : maxContentHeight;
}
)
}
$holder.height(navHeight + maxContentHeight);
}
};
qodefCore.shortcodes.hiroshi_core_tabs.qodefTabs = qodefTabs;
})( jQuery );
(function ($) {
"use strict";
qodefCore.shortcodes.hiroshi_core_single_image = {};
qodefCore.shortcodes.hiroshi_core_single_image.qodefAppear = qodefCore.qodefAppear;
})( jQuery );
(function ($) {
'use strict';
qodefCore.shortcodes.hiroshi_core_text_marquee = {};
$(document).ready(
function () {
qodefTextMarquee.init();
}
);
$(window).resize(
function () {
qodefTextMarquee.init();
}
);
var qodefTextMarquee = {
init : function () {
this.holder = $('.qodef-text-marquee');
if (this.holder.length) {
this.holder.each(
function () {
qodefTextMarquee.prepareContent($(this));
qodefTextMarquee.calculateWidthRatio($(this));
}
);
}
},
prepareContent : function ($currentItem) {
var $contentInnerCopy = $currentItem.find('.qodef--copy');
// remove holder init class
$currentItem.removeClass('qodef--init');
// remove duplicated content
if ($contentInnerCopy.length) {
$contentInnerCopy.remove();
}
},
calculateWidthRatio: function ($currentItem) {
var $content = $currentItem.find('.qodef-m-content'),
$contentInner = $content.find('.qodef-m-content-inner'),
multiplyCoef = Math.ceil($content.outerWidth() / $contentInner.outerWidth()),
i;
// duplicate content at least once
for (i = 0; i < multiplyCoef; i++) {
qodefTextMarquee.duplicateContent($content, $contentInner);
}
// add holder init class
$currentItem.addClass('qodef--init');
},
duplicateContent : function ($content, $contentInner) {
$contentInner.clone().appendTo($content).addClass('qodef--copy');
},
};
qodefCore.shortcodes.hiroshi_core_text_marquee.qodefTextMarquee = qodefTextMarquee;
})(jQuery);
(function ( $ ) {
'use strict';
qodefCore.shortcodes.hiroshi_core_video_button = {};
qodefCore.shortcodes.hiroshi_core_video_button.qodefMagnificPopup = qodef.qodefMagnificPopup;
})( jQuery );
(function ( $ ) {
'use strict';
$( window ).on(
'load',
function () {
qodefStickySidebar.init();
}
);
var qodefStickySidebar = {
init: function () {
var info = $( '.widget_hiroshi_core_sticky_sidebar' );
if ( info.length && qodefCore.windowWidth > 1024 ) {
info.wrapper = info.parents( '#qodef-page-sidebar' );
info.offsetM = info.offset().top - info.wrapper.offset().top;
info.adj = 15;
qodefStickySidebar.callStack( info );
$( window ).on(
'resize',
function () {
if ( qodefCore.windowWidth > 1024 ) {
qodefStickySidebar.callStack( info );
}
}
);
$( window ).on(
'scroll',
function () {
if ( qodefCore.windowWidth > 1024 ) {
qodefStickySidebar.infoPosition( info );
}
}
);
}
},
calc: function ( info ) {
var content = $( '.qodef-page-content-section' ),
headerH = qodefCore.body.hasClass( 'qodef-header-appearance--none' ) ? 0 : parseInt( qodefGlobal.vars.headerHeight, 10 );
// If posts not found set content to have the same height as the sidebar
if ( qodefCore.windowWidth > 1024 && content.height() < 100 ) {
content.css( 'height', info.wrapper.height() - content.height() );
}
info.start = content.offset().top;
info.end = content.outerHeight();
info.h = info.wrapper.height();
info.w = info.outerWidth();
info.left = info.offset().left;
info.top = headerH + qodefGlobal.vars.adminBarHeight - info.offsetM;
info.data( 'state', 'top' );
},
infoPosition: function ( info ) {
if ( qodefCore.scroll < info.start - info.top && qodefCore.scroll + info.h && info.data( 'state' ) !== 'top' ) {
gsap.to(
info.wrapper,
.1,
{
y: 5,
}
);
gsap.to(
info.wrapper,
.3,
{
y: 0,
delay: .1,
}
);
info.data( 'state', 'top' );
info.wrapper.css(
{
'position': 'static',
}
);
} else if ( qodefCore.scroll >= info.start - info.top && qodefCore.scroll + info.h + info.adj <= info.start + info.end &&
info.data( 'state' ) !== 'fixed' ) {
var c = info.data( 'state' ) === 'top' ? 1 : -1;
info.data( 'state', 'fixed' );
info.wrapper.css(
{
'position': 'fixed',
'top': info.top,
'left': info.left,
'width': info.w,
}
);
gsap.fromTo(
info.wrapper,
.2,
{
y: 0
},
{
y: c * 10,
ease: Power4.easeInOut
}
);
gsap.to(
info.wrapper,
.2,
{
y: 0,
delay: .2,
}
);
} else if ( qodefCore.scroll + info.h + info.adj > info.start + info.end && info.data( 'state' ) !== 'bottom' ) {
info.data( 'state', 'bottom' );
info.wrapper.css(
{
'position': 'absolute',
'top': info.end - info.h - info.adj,
'left': 'auto',
'width': info.w,
}
);
gsap.fromTo(
info.wrapper,
.1,
{
y: 0
},
{
y: -5,
}
);
gsap.to(
info.wrapper,
.3,
{
y: 0,
delay: .1,
}
);
}
},
callStack: function ( info ) {
this.calc( info );
this.infoPosition( info );
}
};
})( jQuery );
(function ( $ ) {
'use strict';
var shortcode = 'hiroshi_core_blog_list';
qodefCore.shortcodes[shortcode] = {};
if ( typeof qodefCore.listShortcodesScripts === 'object' ) {
$.each(
qodefCore.listShortcodesScripts,
function ( key, value ) {
qodefCore.shortcodes[shortcode][key] = value;
}
);
}
qodefCore.shortcodes[shortcode].qodefResizeIframes = qodef.qodefResizeIframes;
})( jQuery );
(function ($) {
"use strict";
$(document).ready(function () {
qodefHiroshiSwitchNavMenu.init();
});
/**
* Function object that represents vertical menu area.
* @returns {{init: Function}}
*/
var qodefHiroshiSwitchNavMenu = {
calcDropdown: function($hiroshiSwitchMenuObject) {
var $menu = $hiroshiSwitchMenuObject.find('.qodef-header-switch-navigation'),
$dropdowns = $menu.find('.qodef-drop-down-second').children().children('.sub-menu'),
top = 0;
if ($dropdowns.length) {
$dropdowns.each(function(){
var $thisDropdown = $(this),
$subMenu = $thisDropdown.find('.sub-menu'),
$items = $thisDropdown.children().children('a'),
maxWidth = 0,
translation = 0;
top = $thisDropdown.parent().offset().top - $menu.offset().top;
$items.each(
function () {
var $this = $(this);
//400 is max width of parent holder
if ( 400 <= $this.width() ) {
$this.addClass('qodef-wider');
maxWidth = 400;
} else if ( maxWidth < $this.width() ) {
maxWidth = $this.width();
}
}
);
translation = $thisDropdown.parent().width() - maxWidth;
$thisDropdown.css({ 'top': -top,'width': maxWidth });
$thisDropdown.prepend(`<li class="qodef-menu--back">
<a href="#">
<svg class="qodef-svg--menu-back-arrow" xmlns="http://www.w3.org/2000/svg" width="32" height="11.125" viewBox="0 0 32 11.125">
<path d="M31 3h1v8.125h-1z"/>
<path d="M6 3h26v1H6zM6 3.5V7L3 5.25 0 3.5l3-1.75L6 0v3.5z"/>
</svg>
</a>
</li>`);
if ($subMenu.length) {
$subMenu.each(function () {
var $thisSub = $(this),
$items = $thisSub.children().children('a'),
maxWidth = 0,
translation = 0;
top = $thisSub.parent().offset().top - $menu.offset().top;
$items.each(
function () {
var $this = $(this);
//400 is max width of parent holder
if ( 400 <= $this.width() ) {
$this.addClass('qodef-wider');
maxWidth = 400;
} else if ( maxWidth < $this.width() ) {
maxWidth = $this.width();
}
}
);
translation = $thisSub.parent().width() - maxWidth;
$thisSub.css({'top': -top,'width': maxWidth, 'transform': 'translateX(' + translation + 'px)'});
$thisSub.prepend('<li class="qodef-menu--back"><a href="#"></a></li>');
});
}
});
}
},
dropdownClickToggle: function ($hiroshiSwitchMenuObject) {
var $menuItems = $hiroshiSwitchMenuObject.find('.qodef-header-switch-navigation ul li.menu-item-has-children'),
$backItems = $hiroshiSwitchMenuObject.find('.qodef-menu--back');
$menuItems.each(function () {
var $menuItem = $(this),
$dropdownOpener = $(this).find('> a');
$dropdownOpener.on('click tap', function (e) {
e.preventDefault();
e.stopPropagation();
$menuItem.siblings().addClass('qodef-menu-sibling--open');
$menuItem.addClass('qodef-menu-item--open');
});
});
$backItems.each(function () {
var $backItem = $(this),
$dropdownClose = $backItem.find('a'),
$parentMenuItem = $backItem.closest('.menu-item-has-children');
$dropdownClose.on('click tap', function (e) {
e.preventDefault();
e.stopPropagation();
$parentMenuItem.siblings().removeClass('qodef-menu-sibling--open');
$parentMenuItem.removeClass('qodef-menu-item--open');
});
})
},
init: function () {
var $hiroshiSwitchMenuObject = $('.qodef-header--switch #qodef-page-header');
if ($hiroshiSwitchMenuObject.length) {
qodefHiroshiSwitchNavMenu.calcDropdown($hiroshiSwitchMenuObject);
qodefHiroshiSwitchNavMenu.dropdownClickToggle($hiroshiSwitchMenuObject);
}
}
};
})(jQuery);
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefVerticalNavMenu.init();
}
);
/**
* Function object that represents vertical menu area.
* @returns {{init: Function}}
*/
var qodefVerticalNavMenu = {
calcDropdown: function($verticalMenuObject) {
var $menu = $verticalMenuObject.find('.qodef-header-vertical-navigation'),
$dropdowns = $menu.find('.qodef-drop-down-second').children().children('.sub-menu'),
top = 0;
if ($dropdowns.length) {
$dropdowns.each(function(){
var $thisDropdown = $(this),
$subMenu = $thisDropdown.find('.sub-menu'),
$items = $thisDropdown.children().children('a'),
maxWidth = 0,
translation = 0;
top = $thisDropdown.parent().offset().top - $menu.offset().top;
$items.each(
function () {
var $this = $(this);
//400 is max width of parent holder
if ( 400 <= $this.width() ) {
$this.addClass('qodef-wider');
maxWidth = 400;
} else if ( maxWidth < $this.width() ) {
maxWidth = $this.width();
}
}
);
translation = $thisDropdown.parent().width() - maxWidth;
$thisDropdown.css({ 'top': -top,'width': maxWidth });
$thisDropdown.prepend(`<li class="qodef-menu--back">
<a href="#">
<svg class="qodef-svg--menu-back-arrow" xmlns="http://www.w3.org/2000/svg" width="32" height="11.125" viewBox="0 0 32 11.125">
<path d="M31 3h1v8.125h-1z"/>
<path d="M6 3h26v1H6zM6 3.5V7L3 5.25 0 3.5l3-1.75L6 0v3.5z"/>
</svg>
</a>
</li>`);
if ($subMenu.length) {
$subMenu.each(function () {
var $thisSub = $(this),
$items = $thisSub.children().children('a'),
maxWidth = 0,
translation = 0;
top = $thisSub.parent().offset().top - $menu.offset().top;
$items.each(
function () {
var $this = $(this);
//400 is max width of parent holder
if ( 400 <= $this.width() ) {
$this.addClass('qodef-wider');
maxWidth = 400;
} else if ( maxWidth < $this.width() ) {
maxWidth = $this.width();
}
}
);
translation = $thisSub.parent().width() - maxWidth;
$thisSub.css({'top': -top,'width': maxWidth, 'transform': 'translateX(' + translation + 'px)'});
$thisSub.prepend('<li class="qodef-menu--back"><a href="#"></a></li>');
});
}
});
}
},
dropdownClickToggle: function ($verticalMenuObject) {
var $menuItems = $verticalMenuObject.find('.qodef-header-vertical-navigation ul li.menu-item-has-children'),
$backItems = $verticalMenuObject.find('.qodef-menu--back');
$menuItems.each(function () {
var $menuItem = $(this),
$dropdownOpener = $(this).find('> a');
$dropdownOpener.on('click tap', function (e) {
e.preventDefault();
e.stopPropagation();
$menuItem.siblings().addClass('qodef-menu-sibling--open');
$menuItem.addClass('qodef-menu-item--open');
});
});
$backItems.each(function () {
var $backItem = $(this),
$dropdownClose = $backItem.find('a'),
$parentMenuItem = $backItem.closest('.menu-item-has-children');
$dropdownClose.on('click tap', function (e) {
e.preventDefault();
e.stopPropagation();
$parentMenuItem.siblings().removeClass('qodef-menu-sibling--open');
$parentMenuItem.removeClass('qodef-menu-item--open');
});
})
},
init: function () {
var $verticalMenuObject = $('.qodef-header--vertical #qodef-page-header');
if ($verticalMenuObject.length) {
qodefVerticalNavMenu.calcDropdown($verticalMenuObject);
qodefVerticalNavMenu.dropdownClickToggle($verticalMenuObject);
}
}
};
})( jQuery );
(function ( $ ) {
'use strict';
var fixedHeaderAppearance = {
showHideHeader: function ( $pageOuter, $header ) {
if ( qodefCore.windowWidth > 1024 ) {
if ( qodefCore.scroll <= 0 ) {
qodefCore.body.removeClass( 'qodef-header--fixed-display' );
$pageOuter.css( 'padding-top', '0' );
$header.css( 'margin-top', '0' );
} else {
qodefCore.body.addClass( 'qodef-header--fixed-display' );
$pageOuter.css( 'padding-top', parseInt( qodefGlobal.vars.headerHeight + qodefGlobal.vars.topAreaHeight ) + 'px' );
$header.css( 'margin-top', parseInt( qodefGlobal.vars.topAreaHeight ) + 'px' );
}
}
},
init: function () {
if ( ! qodefCore.body.hasClass( 'qodef-header--vertical' ) ) {
var $pageOuter = $( '#qodef-page-outer' ),
$header = $( '#qodef-page-header' );
fixedHeaderAppearance.showHideHeader( $pageOuter, $header );
$( window ).scroll(
function () {
fixedHeaderAppearance.showHideHeader( $pageOuter, $header );
}
);
$( window ).resize(
function () {
$pageOuter.css( 'padding-top', '0' );
fixedHeaderAppearance.showHideHeader( $pageOuter, $header );
}
);
}
}
};
qodefCore.fixedHeaderAppearance = fixedHeaderAppearance.init;
})( jQuery );
(function ( $ ) {
'use strict';
var stickyHeaderAppearance = {
header: '',
docYScroll: 0,
init: function () {
var displayAmount = stickyHeaderAppearance.displayAmount();
// Set variables
stickyHeaderAppearance.header = $( '.qodef-header-sticky' );
stickyHeaderAppearance.docYScroll = $( document ).scrollTop();
// Set sticky visibility
stickyHeaderAppearance.setVisibility( displayAmount );
$( window ).scroll(
function () {
stickyHeaderAppearance.setVisibility( displayAmount );
}
);
},
displayAmount: function () {
if ( qodefGlobal.vars.qodefStickyHeaderScrollAmount !== 0 ) {
return parseInt( qodefGlobal.vars.qodefStickyHeaderScrollAmount, 10 );
} else {
return parseInt( qodefGlobal.vars.headerHeight + qodefGlobal.vars.adminBarHeight, 10 );
}
},
setVisibility: function ( displayAmount ) {
var isStickyHidden = qodefCore.scroll < displayAmount;
if ( stickyHeaderAppearance.header.hasClass( 'qodef-appearance--up' ) ) {
var currentDocYScroll = $( document ).scrollTop();
isStickyHidden = (currentDocYScroll > stickyHeaderAppearance.docYScroll && currentDocYScroll > displayAmount) || (currentDocYScroll < displayAmount);
stickyHeaderAppearance.docYScroll = $( document ).scrollTop();
}
stickyHeaderAppearance.showHideHeader( isStickyHidden );
},
showHideHeader: function ( isStickyHidden ) {
if ( isStickyHidden ) {
qodefCore.body.removeClass( 'qodef-header--sticky-display' );
} else {
qodefCore.body.addClass( 'qodef-header--sticky-display' );
}
},
};
qodefCore.stickyHeaderAppearance = stickyHeaderAppearance.init;
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefSideAreaMobileHeader.init();
}
);
var qodefSideAreaMobileHeader = {
init: function () {
var $holder = $( '#qodef-side-area-mobile-header' );
if ( $holder.length && qodefCore.body.hasClass( 'qodef-mobile-header--side-area' ) ) {
var $navigation = $holder.find( '.qodef-m-navigation' );
qodefSideAreaMobileHeader.initOpenerTrigger( $holder, $navigation );
qodefSideAreaMobileHeader.initNavigationClickToggle( $navigation );
if ( typeof qodefCore.qodefPerfectScrollbar === 'object' ) {
qodefCore.qodefPerfectScrollbar.init( $holder );
}
}
},
initOpenerTrigger: function ( $holder, $navigation ) {
var $openerIcon = $( '.qodef-side-area-mobile-header-opener' ),
$closeIcon = $holder.children( '.qodef-m-close' );
if ( $openerIcon.length && $navigation.length ) {
$openerIcon.on(
'tap click',
function ( e ) {
e.stopPropagation();
e.preventDefault();
if ( $holder.hasClass( 'qodef--opened' ) ) {
$holder.removeClass( 'qodef--opened' );
} else {
$holder.addClass( 'qodef--opened' );
}
}
);
}
$closeIcon.on(
'tap click',
function ( e ) {
e.stopPropagation();
e.preventDefault();
if ( $holder.hasClass( 'qodef--opened' ) ) {
$holder.removeClass( 'qodef--opened' );
}
}
);
},
initNavigationClickToggle: function ( $navigation ) {
var $menuItems = $navigation.find( 'ul li.menu-item-has-children' );
$menuItems.each(
function () {
var $thisItem = $( this ),
$elementToExpand = $thisItem.find( ' > .qodef-drop-down-second, > ul' ),
$dropdownOpener = $thisItem.find( '> .qodef-menu-item-arrow' ),
slideUpSpeed = 'fast',
slideDownSpeed = 'slow';
$dropdownOpener.on(
'click tap',
function ( e ) {
e.preventDefault();
e.stopPropagation();
if ( $elementToExpand.is( ':visible' ) ) {
$thisItem.removeClass( 'qodef-menu-item--open' );
$elementToExpand.slideUp( slideUpSpeed );
} else if ( $dropdownOpener.parent().parent().children().hasClass( 'qodef-menu-item--open' ) && $dropdownOpener.parent().parent().parent().hasClass( 'qodef-vertical-menu' ) ) {
$thisItem.parent().parent().children().removeClass( 'qodef-menu-item--open' );
$thisItem.parent().parent().children().find( ' > .qodef-drop-down-second' ).slideUp( slideUpSpeed );
$thisItem.addClass( 'qodef-menu-item--open' );
$elementToExpand.slideDown( slideDownSpeed );
} else {
if ( ! $thisItem.parents( 'li' ).hasClass( 'qodef-menu-item--open' ) ) {
$menuItems.removeClass( 'qodef-menu-item--open' );
$menuItems.find( ' > .qodef-drop-down-second, > ul' ).slideUp( slideUpSpeed );
}
if ( $thisItem.parent().parent().children().hasClass( 'qodef-menu-item--open' ) ) {
$thisItem.parent().parent().children().removeClass( 'qodef-menu-item--open' );
$thisItem.parent().parent().children().find( ' > .qodef-drop-down-second, > ul' ).slideUp( slideUpSpeed );
}
$thisItem.addClass( 'qodef-menu-item--open' );
$elementToExpand.slideDown( slideDownSpeed );
}
}
);
}
);
},
};
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefSearchCoversHeader.init();
}
);
var qodefSearchCoversHeader = {
init: function () {
var $searchOpener = $( 'a.qodef-search-opener' ),
$searchForm = $( '.qodef-search-cover-form' ),
$searchClose = $searchForm.find( '.qodef-m-close' );
if ( $searchOpener.length && $searchForm.length ) {
$searchOpener.on(
'click',
function ( e ) {
e.preventDefault();
qodefSearchCoversHeader.openCoversHeader( $searchForm );
}
);
$searchClose.on(
'click',
function ( e ) {
e.preventDefault();
qodefSearchCoversHeader.closeCoversHeader( $searchForm );
}
);
}
},
openCoversHeader: function ( $searchForm ) {
qodefCore.body.addClass( 'qodef-covers-search--opened qodef-covers-search--fadein' );
qodefCore.body.removeClass( 'qodef-covers-search--fadeout' );
setTimeout(
function () {
$searchForm.find( '.qodef-m-form-field' ).focus();
},
600
);
},
closeCoversHeader: function ( $searchForm ) {
qodefCore.body.removeClass( 'qodef-covers-search--opened qodef-covers-search--fadein' );
qodefCore.body.addClass( 'qodef-covers-search--fadeout' );
setTimeout(
function () {
$searchForm.find( '.qodef-m-form-field' ).val( '' );
$searchForm.find( '.qodef-m-form-field' ).blur();
qodefCore.body.removeClass( 'qodef-covers-search--fadeout' );
},
300
);
}
};
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefSearchFullscreen.init();
}
);
var qodefSearchFullscreen = {
init: function () {
var $searchOpener = $( 'a.qodef-search-opener' ),
$searchHolder = $( '.qodef-fullscreen-search-holder' ),
$searchClose = $searchHolder.find( '.qodef-m-close' );
if ( $searchOpener.length && $searchHolder.length ) {
$searchOpener.on(
'click',
function ( e ) {
e.preventDefault();
if ( qodefCore.body.hasClass( 'qodef-fullscreen-search--opened' ) ) {
qodefSearchFullscreen.closeFullscreen( $searchHolder );
} else {
qodefSearchFullscreen.openFullscreen( $searchHolder );
}
}
);
$searchClose.on(
'click',
function ( e ) {
e.preventDefault();
qodefSearchFullscreen.closeFullscreen( $searchHolder );
}
);
//Close on escape
$( document ).keyup(
function ( e ) {
if ( e.keyCode === 27 && qodefCore.body.hasClass( 'qodef-fullscreen-search--opened' ) ) { //KeyCode for ESC button is 27
qodefSearchFullscreen.closeFullscreen( $searchHolder );
}
}
);
}
},
openFullscreen: function ( $searchHolder ) {
qodefCore.body.removeClass( 'qodef-fullscreen-search--fadeout' );
qodefCore.body.addClass( 'qodef-fullscreen-search--opened qodef-fullscreen-search--fadein' );
setTimeout(
function () {
$searchHolder.find( '.qodef-m-form-field' ).focus();
},
900
);
qodefCore.qodefScroll.disable();
},
closeFullscreen: function ( $searchHolder ) {
qodefCore.body.removeClass( 'qodef-fullscreen-search--opened qodef-fullscreen-search--fadein' );
qodefCore.body.addClass( 'qodef-fullscreen-search--fadeout' );
setTimeout(
function () {
$searchHolder.find( '.qodef-m-form-field' ).val( '' );
$searchHolder.find( '.qodef-m-form-field' ).blur();
qodefCore.body.removeClass( 'qodef-fullscreen-search--fadeout' );
},
300
);
qodefCore.qodefScroll.enable();
}
};
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefSearch.init();
}
);
var qodefSearch = {
init: function () {
this.search = $( 'a.qodef-search-opener' );
if ( this.search.length ) {
this.search.each(
function () {
var $thisSearch = $( this );
qodefSearch.searchHoverColor( $thisSearch );
}
);
}
},
searchHoverColor: function ( $searchHolder ) {
if ( typeof $searchHolder.data( 'hover-color' ) !== 'undefined' ) {
var hoverColor = $searchHolder.data( 'hover-color' ),
originalColor = $searchHolder.css( 'color' );
$searchHolder.on(
'mouseenter',
function () {
$searchHolder.css( 'color', hoverColor );
}
).on(
'mouseleave',
function () {
$searchHolder.css( 'color', originalColor );
}
);
}
}
};
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function() {
qodefPredefinedSpinner.init();
}
);
var qodefPredefinedSpinner = {
holder: '',
init: function ( isEditMode ) {
this.holder = $( '#qodef-page-spinner.qodef-layout--predefined' );
if ( this.holder.length ) {
qodefPredefinedSpinner.animateSpinner( this.holder, isEditMode );
}
},
animateSpinner: function ( $holder ) {
var $spinnerText = $holder.find( '.qodef-m-spinner-text' ),
$images = $holder.find( '.qodef-m-spinner-image' );
var tl = gsap.timeline(
{
paused: true,
onStart: () => {
gsap.set(
$holder.find( '.qodef-m-spinner' ),
{
opacity: 1,
}
)
}
}
);
tl
.addLabel( 'start' )
.from(
$images,
{
"--qodef-clip": '100',
xPercent: -10,
stagger: 1.2,
duration: 1.3,
},
)
.to(
$images,
{
xPercent: 100,
duration: 2,
ease: 'power2.inOut',
},
)
.fromTo(
$spinnerText,
{
autoAlpha: 0,
x: 250,
},
{
autoAlpha: 1,
x: 0,
duration: 1,
onComplete: () => {
if (qodefCore.qodefSpinner.windowLoaded) {
tl.pause();
tlOut.play();
}
}
},
'>-1'
)
.to(
$images,
{
duration: 1,
repeat: -1,
onRepeat: () => {
if (qodefCore.qodefSpinner.windowLoaded) {
tl.pause();
tlOut.play();
}
}
},
)
var animateHomes = () => {
qodefCore.shortcodes.hiroshi_core_image_with_text.qodefImageWithTextAppear.init();
}
var tlOut = gsap.timeline(
{
paused: true,
onStart: () => {
animateHomes();
}
}
);
tlOut
.to(
qodefPredefinedSpinner.holder,
{
autoAlpha: 0,
duration: 1
},
)
qodef.qodefWaitForImages.check(
this.holder,
function(){
tl.play();
}
)
},
};
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function() {
qodefProgressBarSpinner.init();
}
);
$( window ).on(
'load',
function () {
qodefProgressBarSpinner.windowLoaded = true;
qodefProgressBarSpinner.completeAnimation();
}
);
$( window ).on(
'elementor/frontend/init',
function () {
var isEditMode = Boolean( elementorFrontend.isEditMode() );
if ( isEditMode ) {
qodefProgressBarSpinner.init( isEditMode );
}
}
);
var qodefProgressBarSpinner = {
holder: '',
windowLoaded: false,
percentNumber: 0,
init: function ( isEditMode ) {
this.holder = $( '#qodef-page-spinner.qodef-layout--progress-bar' );
if ( this.holder.length ) {
qodefProgressBarSpinner.animateSpinner( this.holder, isEditMode );
}
},
animateSpinner: function ( $holder, isEditMode ) {
var $numberHolder = $holder.find( '.qodef-m-spinner-number-label' ),
$spinnerLine = $holder.find( '.qodef-m-spinner-line-front' );
$spinnerLine.animate(
{ 'width': '100%' },
10000,
'linear'
);
var numberInterval = setInterval(
function () {
qodefProgressBarSpinner.animatePercent( $numberHolder, qodefProgressBarSpinner.percentNumber );
if ( qodefProgressBarSpinner.windowLoaded ) {
clearInterval( numberInterval );
}
},
100
);
if ( isEditMode ) {
qodefProgressBarSpinner.fadeOutLoader( $holder );
}
},
completeAnimation: function () {
var $holder = qodefProgressBarSpinner.holder.length ? qodefProgressBarSpinner.holder : $( '#qodef-page-spinner.qodef-layout--progress-bar' );
var numberIntervalFastest = setInterval(
function () {
if ( qodefProgressBarSpinner.percentNumber >= 100 ) {
clearInterval( numberIntervalFastest );
$holder.find( '.qodef-m-spinner-line-front' ).stop().animate(
{ 'width': '100%' },
500
);
$holder.addClass( 'qodef--finished' );
setTimeout(
function () {
qodefProgressBarSpinner.fadeOutLoader( $holder );
},
600
);
} else {
qodefProgressBarSpinner.animatePercent(
$holder.find( '.qodef-m-spinner-number-label' ),
qodefProgressBarSpinner.percentNumber
);
}
},
6
);
},
animatePercent: function ( $numberHolder, percentNumber ) {
if ( percentNumber < 100 ) {
percentNumber += 5;
$numberHolder.text( percentNumber );
qodefProgressBarSpinner.percentNumber = percentNumber;
}
},
fadeOutLoader: function ( $holder, speed, delay, easing ) {
speed = speed ? speed : 600;
delay = delay ? delay : 0;
easing = easing ? easing : 'swing';
$holder.delay( delay ).fadeOut( speed, easing );
$( window ).on(
'bind',
'pageshow',
function ( event ) {
if ( event.originalEvent.persisted ) {
$holder.fadeOut( speed, easing );
}
}
);
}
};
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefTextualSpinner.init();
}
);
$( window ).on(
'load',
function () {
qodefTextualSpinner.windowLoaded = true;
}
);
$( window ).on(
'elementor/frontend/init',
function () {
var isEditMode = Boolean( elementorFrontend.isEditMode() );
if ( isEditMode ) {
qodefTextualSpinner.init( isEditMode );
}
}
);
var qodefTextualSpinner = {
init ( isEditMode ) {
var $holder = $( '#qodef-page-spinner.qodef-layout--textual' );
if ( $holder.length ) {
if ( isEditMode ) {
qodefTextualSpinner.fadeOutLoader( $holder );
} else {
qodefTextualSpinner.splitText( $holder );
}
}
},
splitText ( $holder ) {
var $textHolder = $holder.find( '.qodef-m-text' );
if ( $textHolder.length ) {
var text = $textHolder.text().trim(),
chars = text.split( '' ),
cssClass = '';
$textHolder.empty();
chars.forEach(
( element ) => {
cssClass = (element === ' ' ? 'qodef-m-empty-char' : ' ');
$textHolder.append( '<span class="qodef-m-char ' + cssClass + '">' + element + '</span>' );
}
);
setTimeout(
() => {
qodefTextualSpinner.animateSpinner( $holder );
}, 100
);
}
},
animateSpinner ( $holder ) {
$holder.addClass( 'qodef--init' );
function animationLoop ( animationProps ) {
var $chars = $holder.find( '.qodef-m-char' ),
charsLength = $chars.length - 1;
if ( $chars.length ) {
$chars.each(
( index, element ) => {
var $thisChar = $( element );
setTimeout(
() => {
$thisChar.animate(
animationProps.type,
animationProps.duration,
animationProps.easing,
() => {
if ( index === charsLength ) {
if ( 1 === animationProps.repeat ) {
animationLoop(
{
type: { opacity: 0 },
duration: 1200,
easing: 'swing',
delay: 0,
repeat: 0,
}
);
} else {
if ( ! qodefTextualSpinner.windowLoaded ) {
animationLoop(
{
type: { opacity: 1 },
duration: 1800,
easing: 'swing',
delay: 160,
repeat: 1,
}
);
} else {
qodefTextualSpinner.fadeOutLoader(
$holder,
600,
0,
'swing'
);
setTimeout(
() => {
var $revSlider = $( '.qodef-after-spinner-rev rs-module' );
if ( $revSlider.length ) {
$revSlider.revstart();
}
}, 800
);
}
}
}
}
);
}, index * animationProps.delay
);
}
);
}
}
animationLoop (
{
type: { opacity: 1 },
duration: 1800,
easing: 'swing',
delay: 160,
repeat: 1,
}
);
},
fadeOutLoader( $holder, speed, delay, easing ) {
speed = speed ? speed : 500;
delay = delay ? delay : 0;
easing = easing ? easing : 'swing';
if ( $holder.length ) {
$holder.delay( delay ).fadeOut( speed, easing );
$( window ).on(
'bind',
'pageshow',
function( event ) {
if ( event.originalEvent.persisted ) {
$holder.fadeOut( speed, easing );
}
}
);
}
}
};
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefWishlistDropdown.init();
}
);
/**
* Function object that represents wishlist dropdown.
* @returns {{init: Function}}
*/
var qodefWishlistDropdown = {
init: function () {
var $holder = $( '.qodef-wishlist-dropdown' );
if ( $holder.length ) {
$holder.each(
function () {
var $thisHolder = $( this ),
$link = $thisHolder.find( '.qodef-m-link' );
$link.on(
'click',
function ( e ) {
e.preventDefault();
}
);
qodefWishlistDropdown.removeItem( $thisHolder );
}
);
}
},
removeItem: function ( $holder ) {
var $removeLink = $holder.find( '.qodef-e-remove' );
$removeLink.off().on(
'click',
function ( e ) {
e.preventDefault();
var $thisRemoveLink = $( this ),
removeLinkHTML = $thisRemoveLink.html(),
removeItemID = $thisRemoveLink.data( 'id' );
$thisRemoveLink.html( '<span class="fa fa-spinner fa-spin" aria-hidden="true"></span>' );
var wishlistData = {
type: 'remove',
itemID: removeItemID,
};
$.ajax(
{
type: 'POST',
url: qodefGlobal.vars.restUrl + qodefGlobal.vars.wishlistRestRoute,
data: {
options: wishlistData,
},
beforeSend: function ( request ) {
request.setRequestHeader( 'X-WP-Nonce', qodefGlobal.vars.restNonce );
},
success: function ( response ) {
if ( response.status === 'success' ) {
var newNumberOfItemsValue = parseInt( response.data['count'], 10 );
$holder.find( '.qodef-m-link-count' ).html( newNumberOfItemsValue );
if ( newNumberOfItemsValue === 0 ) {
$holder.removeClass( 'qodef-items--has' ).addClass( 'qodef-items--no' );
}
$thisRemoveLink.closest( '.qodef-m-item' ).fadeOut( 200 ).remove();
$( document ).trigger(
'hiroshi_core_wishlist_item_is_removed',
[removeItemID]
);
} else {
$thisRemoveLink.html( removeLinkHTML );
}
}
}
);
}
);
}
};
$( document ).on(
'hiroshi_core_wishlist_item_is_added',
function ( e, addedItemID, addedUserID ) {
var $holder = $( '.qodef-wishlist-dropdown' );
if ( $holder.length ) {
$holder.each(
function () {
var $thisHolder = $( this ),
$link = $thisHolder.find( '.qodef-m-link' ),
numberOfItemsValue = $link.find( '.qodef-m-link-count' ),
$itemsHolder = $thisHolder.find( '.qodef-m-items' );
var wishlistData = {
itemID: addedItemID,
userID: addedUserID,
};
$.ajax(
{
type: 'POST',
url: qodefGlobal.vars.restUrl + qodefGlobal.vars.wishlistDropdownRestRoute,
data: {
options: wishlistData,
},
beforeSend: function ( request ) {
request.setRequestHeader( 'X-WP-Nonce', qodefGlobal.vars.restNonce );
},
success: function ( response ) {
if ( response.status === 'success' ) {
numberOfItemsValue.html( parseInt( response.data['count'], 10 ) );
if ( $thisHolder.hasClass( 'qodef-items--no' ) ) {
$thisHolder.removeClass( 'qodef-items--no' ).addClass( 'qodef-items--has' );
}
$itemsHolder.append( response.data['new_html'] );
}
},
complete: function () {
qodefWishlistDropdown.init();
}
}
);
}
);
}
}
);
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.hiroshi_core_instagram_list = {};
$( document ).ready(
function () {
qodefInstagram.init();
}
);
var qodefInstagram = {
init: function () {
this.holder = $( '.qodef-instagram-list #sb_instagram' );
if ( this.holder.length ) {
this.holder.each(
function () {
if ( $( this ).parent().hasClass( 'qodef-instagram-columns' ) ) {
var $imagesHolder = $( this ).find( '#sbi_images' ),
$images = $imagesHolder.find( '.sbi_item.sbi_type_image, .sbi_item.sbi_type_carousel' ),
initialPadding = $imagesHolder.css( 'padding' );
// remove some unnecessary paddings
$imagesHolder.css('padding', '0');
$imagesHolder.css('margin', '-' + initialPadding);
$imagesHolder.css('width', 'calc(100% + ' + ( initialPadding) + ' + ' + ( initialPadding) + ')');
$images.attr('style', 'padding: ' + initialPadding + '!important');
} else if ( $( this ).parent().hasClass( 'qodef-instagram-slider' ) ) {
qodefInstagram.initSlider( $( this ) );
}
}
);
}
},
initSlider: function ( $currentItem, $initAllItems ) {
var $imagesHolder = $currentItem.find( '#sbi_images' ),
$images = $currentItem.find( '.sbi_item.sbi_type_image' ),
initialPadding = $imagesHolder.css( 'padding' );
// remove some unnecessary paddings
$imagesHolder.css('padding', '0');
$images.css('padding', '0');
// items will inherit this margin
$imagesHolder.attr('style', 'margin-right: ' + (parseInt( initialPadding ) * 2) + 'px !important');
var sliderOptions = {};
sliderOptions.spaceBetween = parseInt( initialPadding ) * 2;
sliderOptions.customStages = true;
sliderOptions.slidesPerView = $currentItem.data( 'cols' ) !== undefined && $currentItem.data( 'cols' ) !== '' ? $currentItem.data( 'cols' ) : 3;
sliderOptions.slidesPerView1024 = $currentItem.data( 'cols' ) !== undefined && $currentItem.data( 'cols' ) !== '' ? $currentItem.data( 'cols' ) : 3;
sliderOptions.slidesPerView680 = $currentItem.data( 'colstablet' ) !== undefined && $currentItem.data( 'colstablet' ) !== '' ? $currentItem.data( 'colstablet' ) : 2;
sliderOptions.slidesPerView480 = $currentItem.data( 'colsmobile' ) !== undefined && $currentItem.data( 'colsmobile' ) !== '' ? $currentItem.data( 'colsmobile' ) : 1;
$currentItem.attr( 'data-options', JSON.stringify(sliderOptions) );
$imagesHolder.addClass( 'swiper-wrapper' );
if ( $images.length ) {
$images.each(
function () {
$( this ).addClass( 'qodef-e qodef-image-wrapper swiper-slide' );
}
);
}
if ( typeof qodef.qodefSwiper === 'object' ) {
if ( false === $initAllItems ) {
qodef.qodefSwiper.initSlider( $currentItem );
} else {
qodef.qodefSwiper.init( $currentItem );
}
}
},
};
qodefCore.shortcodes.hiroshi_core_instagram_list.qodefInstagram = qodefInstagram;
qodefCore.shortcodes.hiroshi_core_instagram_list.qodefSwiper = qodef.qodefSwiper;
})( jQuery );
(function ( $ ) {
'use strict';
/*
** Re-init scripts on gallery loaded
*/
$( document ).on(
'yith_wccl_product_gallery_loaded',
function () {
if ( typeof qodefCore.qodefWooMagnificPopup === 'function' ) {
qodefCore.qodefWooMagnificPopup.init();
}
}
);
})( jQuery );
(function ($) {
'use strict';
$(document).on(
'qv_loader_stop qv_variation_gallery_loaded',
function () {
qodefYithSelect2.init();
}
);
var qodefYithSelect2 = {
init: function (settings) {
this.holder = [];
this.holder.push(
{
holder: $('#yith-quick-view-modal .variations select'),
options: {
minimumResultsForSearch: Infinity
}
}
);
// Allow overriding the default config
$.extend(this.holder, settings);
if (typeof this.holder === 'object') {
$.each(
this.holder,
function (key, value) {
qodefYithSelect2.createSelect2(value.holder, value.options);
}
);
}
},
createSelect2: function ($holder, options) {
if (typeof $holder.select2 === 'function') {
$holder.select2(options);
}
}
};
})(jQuery);
(function ( $ ) {
'use strict';
qodefCore.shortcodes.hiroshi_core_product_category_list = {};
qodefCore.shortcodes.hiroshi_core_product_category_list.qodefMasonryLayout = qodef.qodefMasonryLayout;
qodefCore.shortcodes.hiroshi_core_product_category_list.qodefSwiper = qodef.qodefSwiper;
})( jQuery );
(function ( $ ) {
'use strict';
var shortcode = 'hiroshi_core_product_list';
qodefCore.shortcodes[shortcode] = {};
if ( typeof qodefCore.listShortcodesScripts === 'object' ) {
$.each(
qodefCore.listShortcodesScripts,
function ( key, value ) {
qodefCore.shortcodes[shortcode][key] = value;
}
);
}
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefDropDownCart.init();
}
);
var qodefDropDownCart = {
init: function () {
var $holder = $( '.qodef-widget-dropdown-cart-content' );
if ( $holder.length ) {
$holder.off().each(
function () {
var $thisHolder = $( this );
qodefDropDownCart.trigger( $thisHolder );
qodefCore.body.on(
'added_to_cart removed_from_cart',
function () {
qodefDropDownCart.init();
}
);
}
);
}
},
trigger: function ( $holder ) {
var $items = $holder.find( '.qodef-woo-mini-cart' );
if ( $items.length && typeof qodefCore.qodefPerfectScrollbar === 'object' ) {
qodefCore.qodefPerfectScrollbar.init( $items );
}
},
};
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.hiroshi_core_clients_list = {};
qodefCore.shortcodes.hiroshi_core_clients_list.qodefSwiper = qodef.qodefSwiper;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.hiroshi_core_fullscreen_portfolio_slider = {};
$( document ).ready(
function () {
qodefFullscreenPortfolioSlider.init();
}
);
var qodefFullscreenPortfolioSlider = {
init: function ( settings ) {
var $slider = $( '.qodef-fullscreen-portfolio-slider .qodef-custom-swiper' );
// Allow overriding the default config
$.extend( $slider, settings );
if ( $slider.length ) {
$slider.each(
function () {
qodefFullscreenPortfolioSlider.createSlider( $( this ) );
}
);
}
},
createSlider: function ($slider) {
var options = qodefFullscreenPortfolioSlider.getOptions( $slider ),
events = qodefFullscreenPortfolioSlider.getEvents( $slider, options );
var $swiper = new Swiper( $slider, Object.assign( options , events ) );
},
getOptions: function ($slider) {
var sliderOptions = typeof $slider.data( 'options' ) !== 'undefined' ? $slider.data( 'options' ) : {},
spaceBetween = sliderOptions.spaceBetween !== undefined && sliderOptions.spaceBetween !== '' ? sliderOptions.spaceBetween : 0,
slidesPerView = sliderOptions.slidesPerView !== undefined && sliderOptions.slidesPerView !== '' ? sliderOptions.slidesPerView : 1,
loop = sliderOptions.loop !== undefined && sliderOptions.loop !== '' ? sliderOptions.loop : true,
autoplay = sliderOptions.autoplay !== undefined && sliderOptions.autoplay !== '' ? sliderOptions.autoplay : true,
pagination = $slider.find( '.swiper-pagination' ),
$items = $slider.find( '.swiper-slide' ),
speed = $slider.parent().hasClass('qodef-item-layout--image-zoom')? 1000 : 800,
duration = 3500,
mousewheel = sliderOptions.mousewheel,
isZoomedSlider = $slider.closest('.qodef-item-layout--image-zoom').length;
if ( autoplay !== false ) {
autoplay = {
disableOnInteraction: false,
delay: duration,
waitForTransition: false,
}
}
var options = {
slidesPerView: slidesPerView,
spaceBetween: spaceBetween,
autoplay: autoplay,
loop: loop,
// loopAdditionalSlides: 0,
speed: speed,
loopedSlides: $items.length,
mousewheel: mousewheel,
pagination: {
el: pagination,
type: 'bullets',
clickable: true,
renderBullet: function (index, className) {
return '<span class="qodef-custom-slider-bullet ' + className + '"></span>';
}
},
isZoomedSlider: isZoomedSlider ? true : false,
};
return Object.assign( options, qodefFullscreenPortfolioSlider.getSliderData( $slider ) );
},
getSliderData: function ($slider) {
var dataList = $slider.data(),
returnValue = {};
for (var property in dataList) {
if (dataList.hasOwnProperty( property )) {
// It's required to be different from data options because da options are all options from shortcode element
if (property !== 'options' && typeof dataList[property] !== 'undefined' && dataList[property] !== '') {
returnValue[property] = dataList[property];
}
}
}
return returnValue;
},
getEvents: function ($slider, options) {
return {
on: {
init: function () {
if (this.params.isZoomedSlider){
setTimeout(
()=>{
this.autoplay.stop();
this.updateSize();
this.autoplay.start();
}, 10
)
}
},
}
};
},
};
qodefCore.shortcodes.hiroshi_core_fullscreen_portfolio_slider.qodefSwiper = qodef.qodefSwiper;
qodefCore.shortcodes.hiroshi_core_fullscreen_portfolio_slider.qodefFullscreenPortfolioSlider = qodefFullscreenPortfolioSlider;
})( jQuery );
(function ( $ ) {
'use strict';
var shortcode = 'hiroshi_core_portfolio_list';
qodefCore.shortcodes[shortcode] = {};
if ( typeof qodefCore.listShortcodesScripts === 'object' ) {
$.each(
qodefCore.listShortcodesScripts,
function ( key, value ) {
qodefCore.shortcodes[shortcode][key] = value;
}
);
}
qodefCore.shortcodes[shortcode].qodefAppear = qodefCore.qodefAppear;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.hiroshi_core_portfolio_slider = {};
$( document ).ready(
function () {
qodefPortfolioSlider.init();
}
);
var qodefPortfolioSlider = {
init: function ( settings ) {
var $slider = $( '.qodef-portfolio-slider' );
// Allow overriding the default config
$.extend( $slider, settings );
if ( $slider.length ) {
$slider.each(
function () {
qodefPortfolioSlider.createSlider( $( this ) );
if ( $slider.hasClass( 'qodef-item-layout--double-image' ) ) {
qodefPortfolioSlider.setInfoPosition( $( this ) );
}
}
);
}
},
createSlider: function ($slider) {
var $swiperHolder = $slider.find( '.qodef-custom-swiper' ),
options = qodefPortfolioSlider.getOptions( $swiperHolder ),
events = qodefPortfolioSlider.getEvents( $slider, options );
var $swiper = new Swiper( $swiperHolder, Object.assign( options, events ) );
},
getOptions: function ($slider) {
var sliderOptions = typeof $slider.data( 'options' ) !== 'undefined' ? $slider.data( 'options' ) : {},
spaceBetween = sliderOptions.spaceBetween !== undefined && sliderOptions.spaceBetween !== '' ? sliderOptions.spaceBetween : 0,
slidesPerView = sliderOptions.slidesPerView !== undefined && sliderOptions.slidesPerView !== '' ? sliderOptions.slidesPerView : 1,
loop = sliderOptions.loop !== undefined && sliderOptions.loop !== '' ? sliderOptions.loop : true,
autoplay = sliderOptions.autoplay !== undefined && sliderOptions.autoplay !== '' ? sliderOptions.autoplay : true,
slideAnimation = sliderOptions.slideAnimation !== undefined && sliderOptions.slideAnimation !== '' ? sliderOptions.slideAnimation : '',
speed = sliderOptions.speed !== undefined && sliderOptions.speed !== '' ? parseInt( sliderOptions.speed, 10 ) : 5000,
speedAnimation = $slider.closest( '.qodef-item-layout--double-image' ).length ? 100 : 1200,
nextNavigation = $slider.find( '.swiper-button-next' ),
prevNavigation = $slider.find( '.swiper-button-prev' ),
pagination = $slider.find( '.swiper-pagination' ),
loopedSlidesLimit = true,
loopAdditionalSlides = sliderOptions.loopAdditionalSlides !== undefined && sliderOptions.loopAdditionalSlides !== '' ? parseInt( sliderOptions.loopAdditionalSlides ) : 0,
loopedSlides = null,
isZoomedSlider = $slider.closest( '.qodef-item-layout--image-zoom ' ).length ? true : false;
if ( slidesPerView === 'auto' ) {
loopedSlides = $slider.find( '.swiper-slide' ).length;
loopAdditionalSlides = loopedSlides;
loopedSlidesLimit = false;
}
if ( autoplay !== false ) {
autoplay = {
disableOnInteraction: false
}
} else if ( autoplay !== false && speed !== 5000 ) {
autoplay = {
delay: speed,
disableOnInteraction: false
};
}
var options = {
slidesPerView: slidesPerView,
spaceBetween: spaceBetween,
autoplay: autoplay,
loop: loop,
loopAdditionalSlides: loopAdditionalSlides,
loopedSlidesLimit: loopedSlidesLimit,
loopedSlides: loopedSlides,
slidesPerGroupAuto: true,
speed: speedAnimation,
centeredSlides: false,
navigation: { nextEl: nextNavigation, prevEl: prevNavigation },
breakpoints: {
// when window width is >= 320px
320: {
slidesPerView: slidesPerView,
},
},
pagination: {
el: pagination,
type: 'fraction',
formatFractionCurrent: function (number) {
return ( '' + number ).slice( -2 );
},
formatFractionTotal: function (number) {
return ( '' + number ).slice( -2 );
},
renderFraction: function (currentClass, totalClass) {
return '<span class="' + currentClass + '"></span>' +
'/' +
'<span class="' + totalClass + '"></span>';
},
clickable: true },
isZoomedSlider: isZoomedSlider
};
if ( slideAnimation.length ) {
switch (slideAnimation) {
case 'fade':
options.effect = 'fade';
options.fadeEffect = {
crossFade: true
};
break;
}
}
return Object.assign( options, qodefPortfolioSlider.getSliderData( $slider ) );
},
getEvents: function ($slider, options) {
return {
on: {
init: function () {
var activeSlide = $slider.find( '.swiper-slide-active' ),
$items = $slider.parent().find( '.qodef-e-info-bottom article' ),
activeIndex = activeSlide.data( 'swiper-slide-index' );
$items.each(
function () {
var item = $( this );
if (item.data( 'index' ) === activeIndex ) {
item.addClass( 'qodef--active' );
} else {
item.removeClass( 'qodef--active' );
}
}
);
setTimeout(
()=>{
this.autoplay.stop();
this.updateSize();
this.autoplay.start();
}, 10
)
},
slidePrevTransitionStart: function() {
$slider.addClass( 'qodef--backwards' );
},
slideNextTransitionStart: function() {
$slider.removeClass( 'qodef--backwards' );
},
slideChangeTransitionStart: function() {
var activeSlide = $slider.find( '.swiper-slide-active' ),
$items = $slider.parent().find( '.qodef-e-info-bottom article' ),
activeIndex = activeSlide.data( 'swiper-slide-index' );
$items.each(
function () {
var item = $( this );
if (item.data( 'index' ) === activeIndex ) {
item.addClass( 'qodef--active' );
} else {
item.removeClass( 'qodef--active' );
}
}
);
},
slideChangeTransitionEnd: function(){
if ( this.params.isZoomedSlider && qodef.windowWidth > 1024){
if ( (this.loopedSlides - 1) === this.realIndex ) {
this.allowSlideNext = false;
$slider.addClass( 'qodef--slide-next-prevented' );
} else {
this.allowSlideNext = true;
$slider.removeClass( 'qodef--slide-next-prevented' );
}
if ( 0 === this.realIndex ) {
this.allowSlidePrev = false;
$slider.addClass( 'qodef--slide-prev-prevented' );
} else {
this.allowSlidePrev = true;
$slider.removeClass( 'qodef--slide-prev-prevented' );
}
}
},
}
};
},
getSliderData: function ($slider) {
var dataList = $slider.data(),
returnValue = {};
for (var property in dataList) {
if (dataList.hasOwnProperty( property )) {
// It's required to be different from data options because da options are all options from shortcode element
if (property !== 'options' && typeof dataList[property] !== 'undefined' && dataList[property] !== '') {
returnValue[property] = dataList[property];
}
}
}
return returnValue;
},
setInfoPosition: function ( $slider ) {
var info = $slider.find( '.qodef-e-info-bottom article' ),
minImage = $slider.find( '.qodef-e-media-image-secondary' );
if ( minImage ) {
var maxHeight = $.makeArray( minImage ).reduce(
( prev, curr ) => {
return prev.offsetHeight >= curr.offsetHeight ? prev.offsetHeight : curr.offsetHeight;
},
0
);
info.css( 'bottom', maxHeight + 115 );
}
},
};
qodefCore.shortcodes.hiroshi_core_portfolio_slider.qodefSwiper = qodef.qodefSwiper;
qodefCore.shortcodes.hiroshi_core_portfolio_slider.qodefPortfolioSlider = qodefPortfolioSlider;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.hiroshi_core_tabbed_portfolio = {};
$( document ).ready(
function () {
qodefTabbedPortfolio.init();
}
);
var qodefTabbedPortfolio = {
init: function () {
var $holder = $( '.qodef-tabbed-portfolio .qodef-e-items-wrapper' );
if ( $holder.length ) {
$holder.each(
function () {
qodefTabbedPortfolio.initAccordion( $( this ) );
}
);
}
},
initAccordion: function ( $accordion ) {
var $acc = $accordion.accordion(
{
animate: 800,
collapsible: true,
active: 0,
icons: '',
heightStyle: 'content',
create: function() {
$accordion.addClass( 'qodef--init' );
}
}
);
$accordion.accordion(
{
beforeActivate: function( event, ui ) {
qodef.qodefWaitForImages.check(
ui.newPanel,
() => {
ui.newPanel.addClass( 'qodef--image-loaded' );
}
)
}
}
);
var $links = $accordion.find( 'a' );
$links.on(
'click',
function ( e ) {
$accordion.accordion( 'disable' );
e.target.click();
}
);
$accordion.on(
'click',
function ( e ) {
$accordion.accordion( 'enable' );
}
);
},
};
qodefCore.shortcodes.hiroshi_core_tabbed_portfolio.qodefTabbedPortfolio = qodefTabbedPortfolio;
})( jQuery );
(function ( $ ) {
'use strict';
var shortcode = 'hiroshi_core_team_list';
qodefCore.shortcodes[shortcode] = {};
if ( typeof qodefCore.listShortcodesScripts === 'object' ) {
$.each(
qodefCore.listShortcodesScripts,
function ( key, value ) {
qodefCore.shortcodes[shortcode][key] = value;
}
);
}
qodefCore.shortcodes[shortcode].qodefAppear = qodefCore.qodefAppear;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.hiroshi_core_testimonials_list = {};
qodefCore.shortcodes.hiroshi_core_testimonials_list.qodefSwiper = qodef.qodefSwiper;
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefInteractiveLinkShowcaseList.init();
}
);
var qodefInteractiveLinkShowcaseList = {
init: function () {
this.holder = $( '.qodef-interactive-link-showcase.qodef-layout--list' );
if ( this.holder.length ) {
this.holder.each(
function () {
qodefInteractiveLinkShowcaseList.initItem( $( this ) );
}
);
}
},
initItem: function ( $currentItem ) {
var $images = $currentItem.find( '.qodef-m-image' ),
$links = $currentItem.find( '.qodef-m-item' );
$images.eq( 0 ).addClass( 'qodef--active qodef--prev' );
$links.eq( 0 ).addClass( 'qodef--active' );
$links.on(
'touchstart mouseenter',
function ( e ) {
var $thisLink = $( this );
if ( ! qodefCore.html.hasClass( 'touchevents' ) || ! $thisLink.hasClass( 'qodef--active' ) ) {
e.preventDefault();
$images.removeClass( 'qodef--active' ).eq( $thisLink.index() ).addClass( 'qodef--active' );
$links.removeClass( 'qodef--active' ).eq( $thisLink.index() ).addClass( 'qodef--active' );
}
}
).on(
'touchend mouseleave',
function () {
var $thisLink = $( this );
if ( ! qodefCore.html.hasClass( 'touchevents' ) || ! $thisLink.hasClass( 'qodef--active' ) ) {
$links.removeClass( 'qodef--active' ).eq( $thisLink.index() ).addClass( 'qodef--active' );
$images.removeClass( 'qodef--active' ).eq( $thisLink.index() ).addClass( 'qodef--active' );
$images.removeClass('qodef--prev');
$images.eq( $thisLink.index()).addClass('qodef--prev');
}
}
);
$currentItem.addClass( 'qodef--init' );
},
};
qodefCore.shortcodes.hiroshi_core_interactive_link_showcase.qodefInteractiveLinkShowcaseList = qodefInteractiveLinkShowcaseList;
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefInteractiveLinkShowcaseSlider.init();
}
);
var qodefInteractiveLinkShowcaseSlider = {
init: function () {
this.holder = $( '.qodef-interactive-link-showcase.qodef-layout--slider' );
if ( this.holder.length ) {
this.holder.each(
function () {
qodefInteractiveLinkShowcaseSlider.initItem( $( this ) );
}
);
}
},
initItem: function ( $currentItem ) {
var $images = $currentItem.find( '.qodef-m-image' );
var $swiperSlider = new Swiper(
$currentItem.find( '.swiper-container' ),
{
loop: true,
slidesPerView: 'auto',
centeredSlides: true,
speed: 1400,
mousewheel: true,
init: false
}
);
qodef.qodefWaitForImages.check(
$currentItem,
function () {
$swiperSlider.init();
}
);
$swiperSlider.on(
'init',
function () {
$images.eq( 0 ).addClass( 'qodef--active' );
$currentItem.find( '.swiper-slide-active' ).addClass( 'qodef--active' );
$swiperSlider.on(
'slideChangeTransitionStart',
function () {
var $swiperSlides = $currentItem.find( '.swiper-slide' ),
$activeSlideItem = $currentItem.find( '.swiper-slide-active' );
$images.removeClass( 'qodef--active' ).eq( $activeSlideItem.data( 'swiper-slide-index' ) ).addClass( 'qodef--active' );
$swiperSlides.removeClass( 'qodef--active' );
$activeSlideItem.addClass( 'qodef--active' );
}
);
$currentItem.find( '.swiper-slide' ).on(
'click',
function ( e ) {
var $thisSwiperLink = $( this ),
$activeSlideItem = $currentItem.find( '.swiper-slide-active' );
if ( ! $thisSwiperLink.hasClass( 'swiper-slide-active' ) ) {
e.preventDefault();
e.stopImmediatePropagation();
if ( e.pageX < $activeSlideItem.offset().left ) {
$swiperSlider.slidePrev();
return false;
}
if ( e.pageX > $activeSlideItem.offset().left + $activeSlideItem.outerWidth() ) {
$swiperSlider.slideNext();
return false;
}
}
}
);
$currentItem.addClass( 'qodef--init' );
}
);
},
};
qodefCore.shortcodes.hiroshi_core_interactive_link_showcase.qodefInteractiveLinkShowcaseSlider = qodefInteractiveLinkShowcaseSlider;
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefPortfolioSliderFixHeight.init();
}
);
var qodefPortfolioSliderFixHeight = {
init: function () {
var $slider = $( '.qodef-fullscreen-portfolio-slider.qodef-item-layout--image-zoom' );
if ( $slider.length ) {
$slider.each(function () {
if ( qodef.windowWidth > 768 ) {
qodefPortfolioSliderFixHeight.setHeight( $( this ) );
}
qodefPortfolioSliderFixHeight.setCustomCursor( $( this ) );
});
}
},
setHeight: function ( $slider ) {
var images = $.makeArray( $slider.find('.swiper-slide') ),
maxHeight = 0;
maxHeight = images.reduce( ( prev, curr ) => {
return prev.offsetHeight >= curr.offsetHeight ? prev.offsetHeight : curr.offsetHeight;
}, 0 );
$(images).each(function () {
$(this).height(maxHeight*2.29);
});
},
setCustomCursor: function ( $slider ) {
var customCursor = $slider.find('.qodef-custom-cursor');
if ( customCursor ) {
var $cursorHolder = $slider.find('.qodef-custom-cursor-holder-wrapper');
$slider.append( $cursorHolder.html() );
$cursorHolder.remove();
var $cursor = $('.qodef-custom-cursor'),
$cursorWrapper = $('.qodef-custom-cursor-holder'),
$content = $slider.find('.qodef-e-content-inner');
$slider.on(
'mousemove',
function (e) {
var x = e.clientX,
y = e.clientY,
deltaY = $cursor.height() / 2,
deltaX = $cursor.width() / 2;
$cursor.css({
'top': y - deltaY,
'left': x - deltaX
});
}
).on(
'mouseleave',
function (e) {
$cursor.css({
visibility: 'hidden',
opacity: 0
});
}
).on(
'mouseenter',
function (e) {
$cursor.css({
visibility: 'visible',
opacity: 1
});
}
);
$content.on(
'mouseenter',
function (e) {
$cursor.css({
visibility: 'hidden',
opacity: 0
});
}
).on(
'mouseleave',
function (e) {
$cursor.css({
visibility: 'visible',
opacity: 1
});
}
);
}
}
};
qodefCore.shortcodes.hiroshi_core_fullscreen_portfolio_slider.qodefPortfolioSliderFixHeight = qodefPortfolioSliderFixHeight;
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefPortfolioSliderFixHeight.init();
}
);
var qodefPortfolioSliderFixHeight = {
init: function () {
var $slider = $( '.qodef-portfolio-slider.qodef-item-layout--image-zoom' );
if ( $slider.length ) {
$slider.each(function () {
qodefPortfolioSliderFixHeight.setHeight( $( this ) );
});
}
},
setHeight: function ( $slider ) {
var images = $.makeArray( $slider.find('.swiper-slide') ),
info = $.makeArray( $slider.find('article') ),
maxHeight = 0,
maxInfoHeight = 0,
threeSlidesCoef = 1.43,
fourSlidesCoef = 2.34;
maxHeight = images.map( e => e.offsetHeight ).reduce( ( prev, curr ) => {
return prev >= curr ? prev : curr;
} );
maxInfoHeight = info.map( e => e.offsetHeight ).reduce( ( prev, curr ) => {
return prev >= curr ? prev : curr;
} );
var theeSlidesHeight = maxHeight * threeSlidesCoef,
fourSlidesHeight = maxHeight * fourSlidesCoef;
$(images).each(function () {
if ( qodef.windowWidth > 1024 ) {
if ( $slider.hasClass('qodef-slides-number--3') ) {
$(this).height( theeSlidesHeight + 48);
} else {
$(this).height( fourSlidesHeight );
}
}
});
$slider.find('.qodef-info').height(maxInfoHeight);
if ( $slider.hasClass('qodef-slides-number--3') ) {
if ( theeSlidesHeight / 5 < maxInfoHeight ) {
$slider.height(theeSlidesHeight + ( maxInfoHeight - theeSlidesHeight / 5 ) );
}
} else {
if ( fourSlidesHeight / 2 < maxInfoHeight ) {
$slider.height(fourSlidesHeight + ( maxInfoHeight - fourSlidesHeight / 2 ) );
}
}
},
};
qodefCore.shortcodes.hiroshi_core_portfolio_slider.qodefPortfolioSliderFixHeight = qodefPortfolioSliderFixHeight;
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefTeamAdditionalLink.init();
}
);
var qodefTeamAdditionalLink = {
init: function () {
this.list = $('.qodef-team-list.qodef-item-layout--info-right');
if (this.list.length) {
this.list.each(
function () {
qodefTeamAdditionalLink.initLink( $(this) );
}
);
}
},
initLink: function ( $list ) {
var $additionalLink = $list.find('.qodef-e-additional-link');
if ( $additionalLink.length ) {
$additionalLink.height($list.find('.qodef-grid-item:first-child').outerHeight());
}
}
}
qodefCore.shortcodes.hiroshi_core_team_list.qodefTeamAdditionalLink = qodefTeamAdditionalLink;
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefInfoFollow.init();
}
);
$( document ).on(
'hiroshi_trigger_get_new_posts',
function () {
qodefInfoFollow.init();
}
);
var qodefInfoFollow = {
init: function () {
var $gallery = $( '.qodef-hover-animation--follow' );
if ( $gallery.length ) {
qodefCore.body.append( '<div class="qodef-e-content-follow"><div class="qodef-e-top-holder"></div><div class="qodef-e-text"></div></div>' );
var $contentFollow = $( '.qodef-e-content-follow' ),
$topHolder = $contentFollow.find( '.qodef-e-top-holder' ),
$textHolder = $contentFollow.find( '.qodef-e-text' );
$gallery.each(
function () {
$gallery.find( '.qodef-e-inner' ).each(
function () {
var $thisItem = $( this );
//info element position
$thisItem.on(
'mousemove',
function ( e ) {
if ( e.clientX + 20 + $contentFollow.width() > qodefCore.windowWidth ) {
$contentFollow.addClass( 'qodef-right' );
} else {
$contentFollow.removeClass( 'qodef-right' );
}
$contentFollow.css(
{
top: e.clientY + 20,
left: e.clientX + 20,
}
);
}
);
//show/hide info element
$thisItem.on(
'mouseenter',
function () {
var $thisItemTopHolder = $( this ).find( '.qodef-e-top-holder' ),
$thisItemTextHolder = $( this ).find( '.qodef-e-text' );
if ( $thisItemTopHolder.length ) {
$topHolder.html( $thisItemTopHolder.html() );
}
if ( $thisItemTextHolder.length ) {
$textHolder.html( $thisItemTextHolder.html() );
}
if ( ! $contentFollow.hasClass( 'qodef-is-active' ) ) {
$contentFollow.addClass( 'qodef-is-active' );
}
}
).on(
'mouseleave',
function () {
if ( $contentFollow.hasClass( 'qodef-is-active' ) ) {
$contentFollow.removeClass( 'qodef-is-active' );
}
}
);
}
);
}
);
}
},
};
qodefCore.shortcodes.hiroshi_core_portfolio_list.qodefInfoFollow = qodefInfoFollow;
})( jQuery );